Skip to content

Commit

Permalink
#5176: fix await element performance regression (#5177)
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Feb 13, 2023
1 parent 3eab9d8 commit 41f3d85
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 8 deletions.
230 changes: 230 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
},
"devDependencies": {
"@fortawesome/fontawesome-common-types": "^0.2.36",
"@shopify/jest-dom-mocks": "^4.1.0",
"@sindresorhus/tsconfig": "^3.0.1",
"@sinonjs/fake-timers": "^10.0.2",
"@storybook/addon-actions": "^6.5.15",
Expand Down
9 changes: 9 additions & 0 deletions src/blocks/effects/wait.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ import { uuidSequence } from "@/testUtils/factories";
import { type BlockOptions } from "@/core";
import { WaitElementEffect } from "@/blocks/effects/wait";
import { BusinessError } from "@/errors/businessErrors";
import { ensureMocksReset, requestIdleCallback } from "@shopify/jest-dom-mocks";

beforeAll(() => {
requestIdleCallback.mock();
});

beforeEach(() => {
ensureMocksReset();
});

const brick = new WaitElementEffect();

Expand Down
12 changes: 12 additions & 0 deletions src/blocks/transformers/tourStep/tourStep.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ import { tick } from "@/extensionPoints/extensionPointTestUtils";
import { MultipleElementsFoundError } from "@/errors/businessErrors";
import { showModal } from "@/blocks/transformers/ephemeralForm/modalUtils";
import { showPopover } from "@/blocks/transformers/temporaryInfo/popoverUtils";
import { ensureMocksReset, requestIdleCallback } from "@shopify/jest-dom-mocks";

beforeAll(() => {
requestIdleCallback.mock();
});

beforeEach(() => {
ensureMocksReset();
});

Element.prototype.scrollIntoView = jest.fn();
browser.runtime.getURL = jest
Expand Down Expand Up @@ -279,6 +288,9 @@ describe("tourStep", () => {
// :initialize:
document.body.innerHTML = '<div id="foo">Foo</div>';

requestIdleCallback.runIdleCallbacks();
// Ticks to allow the setInterval to run
await tick();
await tick();

cancelAllTours();
Expand Down

0 comments on commit 41f3d85

Please sign in to comment.