Skip to content

Commit

Permalink
Put test and elem in this
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Jun 24, 2023
1 parent 8c05f29 commit 5b6b6a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/browser/vdiff.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ mocha.setup({ // eslint-disable-line no-undef
beforeEach() {
const { currentTest } = this;
chai.Assertion.addMethod('golden', function(...args) {
return ScreenshotAndCompare(currentTest, this._obj, ...args); // eslint-disable-line no-invalid-this
return ScreenshotAndCompare.call({ test: currentTest, elem: this._obj }, ...args); // eslint-disable-line no-invalid-this
});
}
}
});

async function ScreenshotAndCompare(test, elem, opts) {
const name = test.fullTitle();
const rect = elem.getBoundingClientRect();
async function ScreenshotAndCompare(opts) {
const name = this.test.fullTitle();
const rect = this.elem.getBoundingClientRect();
const { pass, message } = await executeServerCommand('brightspace-visual-diff', { name, rect, opts });
if (!pass) {
expect.fail(message);
Expand Down

0 comments on commit 5b6b6a8

Please sign in to comment.