зеркало из https://github.com/microsoft/fast.git
await repeat tests, fix incorrect import in router, attempt longer timeout in router tests
This commit is contained in:
Родитель
c6121e527a
Коммит
3ccdd58f77
|
@ -253,7 +253,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
behavior.bind(controller);
|
behavior.bind(controller);
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
createOutput(size, void 0, void 0, input => `<div>${input}</div>`)
|
createOutput(size, void 0, void 0, input => `<div>${input}</div>`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -261,13 +261,13 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal("");
|
await expect(toHTML(parent)).to.equal("");
|
||||||
|
|
||||||
data.items = createArray(size);
|
data.items = createArray(size);
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
createOutput(size, void 0, void 0, input => `<div>${input}</div>`)
|
createOutput(size, void 0, void 0, input => `<div>${input}</div>`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -290,7 +290,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
|
await expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size, x => x !== index)}`
|
`${createOutput(size, x => x !== index)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -337,7 +337,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(`${createOutput(size, x => x !== 0)}`);
|
await expect(toHTML(parent)).to.equal(`${createOutput(size, x => x !== 0)}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size, x => x !== index)}newitem1newitem2`
|
`${createOutput(size, x => x !== index)}newitem1newitem2`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -386,7 +386,7 @@ describe("The repeat", () => {
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expectViewPositionToBeCorrect(behavior);
|
expectViewPositionToBeCorrect(behavior);
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size, x => x !== index)}newitem1newitem2`
|
`${createOutput(size, x => x !== index)}newitem1newitem2`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -409,7 +409,7 @@ describe("The repeat", () => {
|
||||||
const mid = Math.floor(vm.items.length/2)
|
const mid = Math.floor(vm.items.length/2)
|
||||||
vm.items.splice(mid, 1, { name: "newitem1" });
|
vm.items.splice(mid, 1, { name: "newitem1" });
|
||||||
await Updates.next();
|
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 () => {
|
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 () => {
|
||||||
|
@ -433,7 +433,7 @@ describe("The repeat", () => {
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expectViewPositionToBeCorrect(behavior);
|
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 ) }`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ describe("The repeat", () => {
|
||||||
const mid = Math.floor(vm.items.length/2)
|
const mid = Math.floor(vm.items.length/2)
|
||||||
vm.items.splice(mid, 2, { name: "newitem1" }, { name: "newitem2" });
|
vm.items.splice(mid, 2, { name: "newitem1" }, { name: "newitem2" });
|
||||||
await Updates.next();
|
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 () => {
|
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 () => {
|
||||||
|
@ -475,7 +475,7 @@ describe("The repeat", () => {
|
||||||
const mid = Math.floor(vm.items.length/2)
|
const mid = Math.floor(vm.items.length/2)
|
||||||
vm.items.splice(mid, 2, { name: "newitem1" }, { name: "newitem2" });
|
vm.items.splice(mid, 2, { name: "newitem1" }, { name: "newitem2" });
|
||||||
await Updates.next();
|
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 () => {
|
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();
|
const { parent, targets, nodeId } = createLocation();
|
||||||
|
@ -496,12 +496,12 @@ describe("The repeat", () => {
|
||||||
vm.items.splice(0, vm.items.length, ...vm.items);
|
vm.items.splice(0, vm.items.length, ...vm.items);
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
expectViewPositionToBeCorrect(behavior);
|
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);
|
vm.items.splice(0, vm.items.length, ...vm.items);
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
expectViewPositionToBeCorrect(behavior);
|
expectViewPositionToBeCorrect(behavior);
|
||||||
expect(toHTML(parent)).to.equal(createOutput(size));
|
await expect(toHTML(parent)).to.equal(createOutput(size));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`newitem1newitem2${createOutput(size, x => x !== 0)}`
|
`newitem1newitem2${createOutput(size, x => x !== 0)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -549,7 +549,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(createOutput(size, () => true, "*"));
|
await expect(toHTML(parent)).to.equal(createOutput(size, () => true, "*"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
for (let i = 0; i < size; ++i) {
|
for (let i = 0; i < size; ++i) {
|
||||||
const str = `child-item${i + 1}root-root`;
|
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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -602,7 +602,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`shift${createOutput(size, index => index !== 0)}`
|
`shift${createOutput(size, index => index !== 0)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -627,7 +627,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`shiftshift${createOutput(size, index => index !== 0)}`
|
`shiftshift${createOutput(size, index => index !== 0)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -653,7 +653,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`shift2${createOutput(size, index => index !== 0)}`
|
`shift2${createOutput(size, index => index !== 0)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -678,7 +678,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size, index => index !== 0)}shift3`
|
`${createOutput(size, index => index !== 0)}shift3`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -703,7 +703,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size, index => index !== 0)}shift3`
|
`${createOutput(size, index => index !== 0)}shift3`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -728,7 +728,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size)}`
|
`${createOutput(size)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -753,7 +753,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`${createOutput(size-1)}shift3`
|
`${createOutput(size-1)}shift3`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -779,7 +779,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`shift1shift2${createOutput(size-1)}shift3`
|
`shift1shift2${createOutput(size-1)}shift3`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -805,7 +805,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(
|
await expect(toHTML(parent)).to.equal(
|
||||||
`shift1shift2${createOutput(size)}`
|
`shift1shift2${createOutput(size)}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -831,7 +831,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
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 ) }`
|
`shift1shift2${createOutput(size -1, index => index !== 0, void 0, void 0, 1 ) }`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -865,7 +865,7 @@ describe("The repeat", () => {
|
||||||
|
|
||||||
await Updates.next();
|
await Updates.next();
|
||||||
|
|
||||||
expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
|
await expect(toHTML(parent)).to.equal(`${createOutput(size)}newitem`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@esm-bundle/chai": "4.3.4-fix.0",
|
"@esm-bundle/chai": "4.3.4-fix.0",
|
||||||
"@microsoft/api-extractor": "7.24.2",
|
"@microsoft/api-extractor": "7.24.2",
|
||||||
|
"@web/test-runner": "0.17.0",
|
||||||
|
"@web/test-runner-playwright": "0.10.1",
|
||||||
"@types/mocha": "^7.0.2",
|
"@types/mocha": "^7.0.2",
|
||||||
"@types/webpack-env": "^1.15.2",
|
"@types/webpack-env": "^1.15.2",
|
||||||
"esm": "^3.2.25",
|
"esm": "^3.2.25",
|
||||||
|
@ -49,9 +51,7 @@
|
||||||
"ts-loader": "^7.0.2",
|
"ts-loader": "^7.0.2",
|
||||||
"ts-node": "^8.9.1",
|
"ts-node": "^8.9.1",
|
||||||
"tsconfig-paths": "^3.9.0",
|
"tsconfig-paths": "^3.9.0",
|
||||||
"typescript": "^4.7.0",
|
"typescript": "^4.7.0"
|
||||||
"webpack": "^5.72.0",
|
|
||||||
"webpack-cli": "^4.9.2"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@microsoft/fast-element": "^2.0.0-beta.26"
|
"@microsoft/fast-element": "^2.0.0-beta.26"
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {
|
||||||
Endpoint,
|
Endpoint,
|
||||||
RecognizedRoute,
|
RecognizedRoute,
|
||||||
} from "./recognizer.js";
|
} from "./recognizer.js";
|
||||||
import { expect } from "@esm-bundle/chai";;
|
import { expect } from "@esm-bundle/chai";
|
||||||
|
|
||||||
describe(DefaultRouteRecognizer.name, function () {
|
describe(DefaultRouteRecognizer.name, function () {
|
||||||
interface RecognizeSpec {
|
interface RecognizeSpec {
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
import { playwrightLauncher } from "@web/test-runner-playwright";
|
import { playwrightLauncher } from "@web/test-runner-playwright";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
concurrency: 10,
|
|
||||||
coverage: true,
|
coverage: true,
|
||||||
nodeResolve: true,
|
nodeResolve: true,
|
||||||
|
testsFinishTimeout: 200000,
|
||||||
// in a monorepo you need to set set the root dir to resolve modules
|
// in a monorepo you need to set set the root dir to resolve modules
|
||||||
rootDir: "../../../",
|
rootDir: "../../../",
|
||||||
playwright: true,
|
playwright: true,
|
||||||
browsers: [
|
browsers: [
|
||||||
playwrightLauncher({ product: "chromium" }),
|
playwrightLauncher({ product: "chromium" }),
|
||||||
playwrightLauncher({ product: "firefox" }),
|
|
||||||
playwrightLauncher({ product: "webkit" }),
|
|
||||||
],
|
],
|
||||||
files: [
|
files: [
|
||||||
"dist/esm/**/*.spec.js",
|
"dist/esm/**/*.spec.js",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче