diff options
author | Diego Zambelli Sessona <diego.sessona@gmail.com> | 2023-11-14 18:53:44 +0100 |
---|---|---|
committer | Diego Zambelli Sessona <diego.sessona@gmail.com> | 2023-11-14 19:00:34 +0100 |
commit | c38f0c939c67b64e12b275eec1c5caad5f157540 (patch) | |
tree | 4ef25074339065fa07458c57189046098dce2d34 | |
parent | 3c9d554480f05d67a64bf6ae926b8057f66e9731 (diff) |
Make gr-comment-thread test reliable in stable-3.6
Depending on the version of the browser that the CI
gets to execute the polygerrit tests, the test was
unreliable because the whitespaces in the stlye
attribute was getting stripped off.
The test now checks the equality of the dom for the
`view-diff-container` element as before, while
checking stlyle, id and classes indipendently for
the `gr-diff` elememt.
Bug: Issue 310756438
Release-Notes: skip
Change-Id: I96186544fb435b9d0b167e7a30e41555070540c1
-rw-r--r-- | polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts index 0329a4ed8a..3573197180 100644 --- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts +++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts @@ -278,27 +278,32 @@ suite('gr-comment-thread tests', () => { element.showCommentContext = true; element.thread = createThread(commentWithContext); await element.updateComplete; - expect(queryAndAssert(element, '.diff-container')).dom.to.equal(/* HTML */ ` - <div class="diff-container"> - <gr-diff - class="disable-context-control-buttons hide-line-length-indicator no-left" - id="diff" - style="--line-limit-marker:100ch; --content-width:none; --diff-max-width:none; --font-size:12px;" - > - </gr-diff> - <div class="view-diff-container"> - <a href=""> - <gr-button - aria-disabled="false" - class="view-diff-button" - link="" - role="button" - tabindex="0" - > - View Diff - </gr-button> - </a> - </div> + + const gr_diff = queryAndAssert(element, '.diff-container gr-diff'); + expect(gr_diff.id).to.equal('diff'); + const gr_diff_classes = gr_diff.classList.value; + expect(gr_diff_classes).to.include('disable-context-control-buttons'); + expect(gr_diff_classes).to.include('hide-line-length-indicator'); + expect(gr_diff_classes).to.include('no-left'); + // @ts-ignore + expect(gr_diff.getAttribute('style').replace(/\s+/g, '')).to.equal( + '--line-limit-marker:100ch;--content-width:none;--diff-max-width:none;--font-size:12px;' + ); + + expect(queryAndAssert(element, '.diff-container .view-diff-container')).dom + .to.equal(/* HTML */ ` + <div class="view-diff-container"> + <a href=""> + <gr-button + aria-disabled="false" + class="view-diff-button" + link="" + role="button" + tabindex="0" + > + View Diff + </gr-button> + </a> </div> `); }); |