Skip to content

Commit

Permalink
📦 Update dependency eslint-plugin-chai-expect to v3.1.0 (#40054)
Browse files Browse the repository at this point in the history
* 📦 Update dependency eslint-plugin-chai-expect to v3.1.0

* Modify empty `expect` call to be a Chai property instead

* `amp lint --fix`

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Rozenberg <[email protected]>
  • Loading branch information
renovate[bot] and danielrozenberg committed Jun 13, 2024
1 parent 6d0a08e commit d3dfd24
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 53 deletions.
73 changes: 30 additions & 43 deletions extensions/amp-auto-lightbox/0.1/test/test-amp-auto-lightbox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {Assertion} from 'chai';

import {CommonSignals_Enum} from '#core/constants/common-signals';
import {tryResolve} from '#core/data-structures/promise';
import {Signals} from '#core/data-structures/signals';
Expand Down Expand Up @@ -293,22 +295,23 @@ describes.realWin(
const areaDeltaPerc = RENDER_AREA_RATIO * 100;
const {vh, vw} = {vw: 1000, vh: 600};

const expectMeetsSizingCriteria = (
renderWidth,
renderHeight,
naturalWidth,
naturalHeight
) =>
expect(
Assertion.addProperty('meetSizingCriteria', function () {
const {naturalHeight, naturalWidth, renderHeight, renderWidth} =
this._obj;
this.assert(
meetsSizingCriteria(
renderWidth,
renderHeight,
naturalWidth,
naturalHeight,
vw,
vh
)
),
'expected #{this} to meet sizing criteria for #{exp}',
'expected #{this} to not meet sizing criteria for #{exp}',
{vw, vh}
);
});

it(`accepts elements ${areaDeltaPerc}%+ of size than render area`, () => {
const renderWidth = 1000;
Expand All @@ -321,12 +324,8 @@ describes.realWin(

const axisRange = [minDim + 1, minDim + 10, minDim + 100];
iterProduct(axisRange, axisRange, (naturalWidth, naturalHeight) => {
expectMeetsSizingCriteria(
renderWidth,
renderHeight,
naturalWidth,
naturalHeight
).to.be.true;
expect({renderWidth, renderHeight, naturalWidth, naturalHeight}).to
.meetSizingCriteria;
});
});

Expand All @@ -341,12 +340,8 @@ describes.realWin(

const axisRange = [minDim, minDim - 10, minDim - 100];
iterProduct(axisRange, axisRange, (naturalWidth, naturalHeight) => {
expectMeetsSizingCriteria(
renderWidth,
renderHeight,
naturalWidth,
naturalHeight
).to.be.false;
expect({renderWidth, renderHeight, naturalWidth, naturalHeight}).to
.not.meetSizingCriteria;
});
});

Expand All @@ -361,12 +356,8 @@ describes.realWin(

const axisRange = [minDim, minDim + 10, minDim + 100];
iterProduct(axisRange, axisRange, (renderWidth, renderHeight) => {
expectMeetsSizingCriteria(
renderWidth,
renderHeight,
naturalWidth,
naturalHeight
).to.be.true;
expect({renderWidth, renderHeight, naturalWidth, naturalHeight}).to
.meetSizingCriteria;
});
});

Expand All @@ -376,12 +367,12 @@ describes.realWin(

const axisRange = [minDim - 1, minDim - 10, minDim - 100];
iterProduct(axisRange, axisRange, (renderWidth, renderHeight) => {
expectMeetsSizingCriteria(
expect({
renderWidth,
renderHeight,
/* naturalWidth */ renderWidth,
/* naturalHeight */ renderHeight
).to.be.false;
naturalWidth: renderWidth,
naturalHeight: renderHeight,
}).to.not.meetSizingCriteria;
});
});

Expand All @@ -390,12 +381,12 @@ describes.realWin(
const renderHeight = vh;

[vh + 1, vh + 10, vh + 100].forEach((naturalHeight) => {
expectMeetsSizingCriteria(
expect({
renderWidth,
renderHeight,
/* naturalWidth */ renderWidth,
naturalHeight
).to.be.true;
naturalWidth: renderWidth,
naturalHeight,
}).to.meetSizingCriteria;
});
});

Expand All @@ -404,12 +395,12 @@ describes.realWin(
const renderHeight = vh;

[vw + 1, vw + 10, vw + 100].forEach((naturalWidth) => {
expectMeetsSizingCriteria(
expect({
renderWidth,
renderHeight,
naturalWidth,
/* naturalHeight */ renderHeight
).to.be.true;
naturalHeight: renderHeight,
}).to.meetSizingCriteria;
});
});

Expand All @@ -419,12 +410,8 @@ describes.realWin(

const axisRange = [renderWidth, renderWidth - 10, renderWidth - 100];
iterProduct(axisRange, axisRange, (naturalWidth, naturalHeight) => {
expectMeetsSizingCriteria(
renderWidth,
renderHeight,
naturalWidth,
naturalHeight
).to.be.false;
expect({renderWidth, renderHeight, naturalWidth, naturalHeight}).to
.not.meetSizingCriteria;
});
});
});
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-babel-module": "5.3.2",
"eslint-plugin-chai-expect": "3.0.0",
"eslint-plugin-chai-expect": "3.1.0",
"eslint-plugin-eslint-plugin": "5.5.1",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jasmine": "4.1.3",
Expand Down

0 comments on commit d3dfd24

Please sign in to comment.