Skip to content

Commit

Permalink
Rename to vdiff-rect
Browse files Browse the repository at this point in the history
  • Loading branch information
svanherk committed Aug 24, 2023
1 parent db788a4 commit 1073c67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/browser/vdiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ mocha.setup({
});
/* eslint-enable */

function findRealSize(elem) {
function findRectElem(elem) {
if (!elem.shadowRoot) return elem;
const nestedSizedElem = elem.shadowRoot.querySelector('.vdiff-size');
if (!nestedSizedElem) return elem;
return findRealSize(nestedSizedElem);
const nestedRectElem = elem.shadowRoot.querySelector('.vdiff-rect');
if (!nestedRectElem) return elem;
return findRectElem(nestedRectElem);
}

async function ScreenshotAndCompare(opts) {
Expand All @@ -36,8 +36,8 @@ async function ScreenshotAndCompare(opts) {
const name = this.test.fullTitle();
let rect = null;
if (this.elem !== document) {
const realSizedElem = findRealSize(this.elem);
rect = realSizedElem.getBoundingClientRect();
const rectElem = findRectElem(this.elem);
rect = rectElem.getBoundingClientRect();
}
const slowDuration = this.test.slow();
let result = await executeServerCommand('brightspace-visual-diff-compare', { name, rect, slowDuration, opts });
Expand Down
4 changes: 2 additions & 2 deletions test/browser/element.vdiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const fixedElementTag = defineCE(
}
render() {
return html`
<div class="vdiff-size">
<div class="vdiff-rect">
<slot></slot>
</div>
`;
Expand All @@ -68,7 +68,7 @@ const nestedElementTag = defineCE(
class extends LitElement {
render() {
return html`${unsafeHTML(`
<${fixedElementTag} class="vdiff-size"><${elementTag} text="Visual Difference"></${elementTag}></${fixedElementTag}>
<${fixedElementTag} class="vdiff-rect"><${elementTag} text="Visual Difference"></${elementTag}></${fixedElementTag}>
`)}`;
}
}
Expand Down

0 comments on commit 1073c67

Please sign in to comment.