Skip to content

Commit

Permalink
await repeat tests to check timeout issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdholt committed Sep 30, 2023
1 parent cb0effa commit 8d014d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
56 changes: 28 additions & 28 deletions packages/web-components/fast-element/src/templating/repeat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,21 @@ describe("The repeat", () => {

behavior.bind(controller);

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
createOutput(size, void 0, void 0, input => `<div>${input}</div>`)
);

data.items = [];

await Updates.next();

expect(toHTML(parent)).to.equal("");
await expect(toHTML(parent)).to.equal("");

data.items = createArray(size);

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
createOutput(size, void 0, void 0, input => `<div>${input}</div>`)
);
});
Expand All @@ -290,7 +290,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
await expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
});
});

Expand All @@ -313,7 +313,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size, x => x !== index)}`
);
});
Expand All @@ -337,7 +337,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(`${createOutput(size, x => x !== 0)}`);
await expect(toHTML(parent)).to.equal(`${createOutput(size, x => x !== 0)}`);
});
});

Expand All @@ -360,7 +360,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size, x => x !== index)}newitem1newitem2`
);
});
Expand All @@ -386,7 +386,7 @@ describe("The repeat", () => {
await Updates.next();

expectViewPositionToBeCorrect(behavior);
expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size, x => x !== index)}newitem1newitem2`
);
});
Expand All @@ -409,7 +409,7 @@ describe("The repeat", () => {
const mid = Math.floor(vm.items.length/2)
vm.items.splice(mid, 1, { name: "newitem1" });
await Updates.next();
expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1${createOutput(vm.items.slice(mid +1).length , void 0, void 0, void 0, mid +1 ) }`);
await expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1${createOutput(vm.items.slice(mid +1).length , void 0, void 0, void 0, mid +1 ) }`);
});

it(`updates rendered HTML when a single item is spliced from the middle of an array of size ${size} with recycle property set to false`, async () => {
Expand All @@ -433,7 +433,7 @@ describe("The repeat", () => {
await Updates.next();

expectViewPositionToBeCorrect(behavior);
expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1${createOutput(vm.items.slice(mid +1).length , void 0, void 0, void 0, mid +1 ) }`);
await expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1${createOutput(vm.items.slice(mid +1).length , void 0, void 0, void 0, mid +1 ) }`);
});
});

Expand All @@ -454,7 +454,7 @@ describe("The repeat", () => {
const mid = Math.floor(vm.items.length/2)
vm.items.splice(mid, 2, { name: "newitem1" }, { name: "newitem2" });
await Updates.next();
expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1newitem2${createOutput(vm.items.slice(mid +2).length , void 0, void 0, void 0, mid +2 ) }`);
await expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1newitem2${createOutput(vm.items.slice(mid +2).length , void 0, void 0, void 0, mid +2 ) }`);
});

it(`updates rendered HTML when 2 items are spliced from the middle of an array of size ${size} with recycle property set to false`, async () => {
Expand All @@ -475,7 +475,7 @@ describe("The repeat", () => {
const mid = Math.floor(vm.items.length/2)
vm.items.splice(mid, 2, { name: "newitem1" }, { name: "newitem2" });
await Updates.next();
expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1newitem2${createOutput(vm.items.slice(mid +2).length , void 0, void 0, void 0, mid +2 ) }`);
await expect(toHTML(parent)).to.equal(`${createOutput(mid)}newitem1newitem2${createOutput(vm.items.slice(mid +2).length , void 0, void 0, void 0, mid +2 ) }`);
});
it(`updates rendered HTML when all items are spliced to replace entire array with an array of size ${size}`, async () => {
const { parent, targets, nodeId } = createLocation();
Expand All @@ -496,12 +496,12 @@ describe("The repeat", () => {
vm.items.splice(0, vm.items.length, ...vm.items);
await Updates.next();
expectViewPositionToBeCorrect(behavior);
expect(toHTML(parent)).to.equal(createOutput(size));
await expect(toHTML(parent)).to.equal(createOutput(size));

vm.items.splice(0, vm.items.length, ...vm.items);
await Updates.next();
expectViewPositionToBeCorrect(behavior);
expect(toHTML(parent)).to.equal(createOutput(size));
await expect(toHTML(parent)).to.equal(createOutput(size));
});
});

Expand All @@ -523,7 +523,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`newitem1newitem2${createOutput(size, x => x !== 0)}`
);
});
Expand All @@ -549,7 +549,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(createOutput(size, () => true, "*"));
await expect(toHTML(parent)).to.equal(createOutput(size, () => true, "*"));
});
});

Expand Down Expand Up @@ -578,7 +578,7 @@ describe("The repeat", () => {

for (let i = 0; i < size; ++i) {
const str = `child-item${i + 1}root-root`;
expect(text.indexOf(str)).to.not.equal(-1);
await expect(text.indexOf(str)).to.not.equal(-1);
}
});
});
Expand All @@ -602,7 +602,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`shift${createOutput(size, index => index !== 0)}`
);
});
Expand All @@ -627,7 +627,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`shiftshift${createOutput(size, index => index !== 0)}`
);
});
Expand All @@ -653,7 +653,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`shift2${createOutput(size, index => index !== 0)}`
);
});
Expand All @@ -678,7 +678,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size, index => index !== 0)}shift3`
);
});
Expand All @@ -703,7 +703,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size, index => index !== 0)}shift3`
);
});
Expand All @@ -728,7 +728,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size)}`
);
});
Expand All @@ -753,7 +753,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`${createOutput(size-1)}shift3`
);
});
Expand All @@ -779,7 +779,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`shift1shift2${createOutput(size-1)}shift3`
);
});
Expand All @@ -805,7 +805,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`shift1shift2${createOutput(size)}`
);
});
Expand All @@ -831,7 +831,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(
await expect(toHTML(parent)).to.equal(
`shift1shift2${createOutput(size -1, index => index !== 0, void 0, void 0, 1 ) }`
);
});
Expand Down Expand Up @@ -865,7 +865,7 @@ describe("The repeat", () => {

await Updates.next();

expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
await expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export default {
playwright: true,
browsers: [
playwrightLauncher({ product: "chromium" }),
playwrightLauncher({ product: "firefox" }),
playwrightLauncher({ product: "webkit" }),
],
files: [
"dist/esm/**/*.spec.js",
Expand Down

0 comments on commit 8d014d1

Please sign in to comment.