From cb107cef7d48d2429303c96a68e63f420a8191dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 16 Nov 2021 16:50:21 +0100 Subject: [PATCH] [REM] remove some outdated tests --- tests/compiler/t_call.test.ts | 7 -- .../__snapshots__/basics.test.ts.snap | 38 ------- tests/components/basics.test.ts | 100 ------------------ 3 files changed, 145 deletions(-) diff --git a/tests/compiler/t_call.test.ts b/tests/compiler/t_call.test.ts index b53c6107..e6bc371c 100644 --- a/tests/compiler/t_call.test.ts +++ b/tests/compiler/t_call.test.ts @@ -15,13 +15,6 @@ describe("t-call (template calling)", () => { expect(context.renderToString("caller")).toBe("
ok
"); }); - test.skip("t-call, global templates", () => { - // QWeb.registerTemplate("abcd", '
'); - // qweb.addTemplate("john", `desk`); - // const expected = "
desk
"; - // expect(trim(renderToString(qweb, "abcd"))).toBe(expected); - }); - test("basic caller, no parent node", () => { const context = new TestContext(); context.addTemplate("_basic-callee", `ok`); diff --git a/tests/components/__snapshots__/basics.test.ts.snap b/tests/components/__snapshots__/basics.test.ts.snap index 6a4dd2c9..94ce15bf 100644 --- a/tests/components/__snapshots__/basics.test.ts.snap +++ b/tests/components/__snapshots__/basics.test.ts.snap @@ -356,44 +356,6 @@ exports[`basics do not remove previously rendered dom if not necessary, variatio }" `; -exports[`basics don't fallback to component's registry if widget defined in the instance's context 1`] = ` -"function anonymous(bdom, helpers -) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; - let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers; - - let block1 = createBlock(\`ChildB\`); - - return function template(ctx, node, key = \\"\\") { - return block1(); - } -}" -`; - -exports[`basics don't fallback to component's registry if widget defined in the instance's context 2`] = ` -"function anonymous(bdom, helpers -) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; - let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers; - - return function template(ctx, node, key = \\"\\") { - return component(\`Child\`, {}, key + \`__1\`, node, ctx); - } -}" -`; - -exports[`basics don't fallback to component's registry if widget defined in the instance's context 3`] = ` -"function anonymous(bdom, helpers -) { - let { text, createBlock, list, multi, html, toggler, component } = bdom; - let { withDefault, getTemplate, prepareList, withKey, zero, call, callSlot, capture, shallowEqual } = helpers; - - return function template(ctx, node, key = \\"\\") { - return component(\`Child\`, {}, key + \`__1\`, node, ctx); - } -}" -`; - exports[`basics has no el after creation 1`] = ` "function anonymous(bdom, helpers ) { diff --git a/tests/components/basics.test.ts b/tests/components/basics.test.ts index 46e1d9d8..609f07b6 100644 --- a/tests/components/basics.test.ts +++ b/tests/components/basics.test.ts @@ -677,23 +677,6 @@ describe("basics", () => { expect(fixture.innerHTML).toBe("
hey
"); }); - // TODO: implement scope lookup for components - test.skip("don't fallback to component's registry if widget defined in the instance's context", async () => { - class ChildA extends Component { - static template = xml`ChildA`; - } - class ChildB extends Component { - static template = xml`ChildB`; - } - class Parent extends Component { - static template = xml``; - static components = { Child: ChildA }; - Child = ChildB; - } - await mount(Parent, fixture); - expect(fixture.innerHTML).toBe("ChildB"); - }); - test("sub components between t-ifs", async () => { // this confuses the patching algorithm... class Child extends Component { @@ -859,89 +842,6 @@ describe("mount targets", () => { }); }); -describe.skip("mount special cases", () => { - test("component can be mounted on different target", async () => { - // class Comp extends Component { - // static template = xml`
Hey
`; - // setup() { - // onPatched(() => { - // throw new Error("patched should not be called"); - // }); - // } - // } - // const div = document.createElement("div"); - // const span = document.createElement("span"); - // fixture.appendChild(div); - // fixture.appendChild(span); - // const comp = await mount(Comp, div); - // expect(fixture.innerHTML).toBe("
Hey
"); - // await comp.__owl__.mount(span, ); - // expect(fixture.innerHTML).toBe("
Hey
"); - }); - - test("widget can be mounted on different target, another situation", async () => { - // const def = makeDeferred(); - // const steps: string[] = []; - // class MyWidget extends Component { - // static template = xml`
Hey
`; - // async willStart() { - // return def; - // } - // patched() { - // throw new Error("patched should not be called"); - // } - // } - // const div = document.createElement("div"); - // const span = document.createElement("span"); - // fixture.appendChild(div); - // fixture.appendChild(span); - // const w = new MyWidget(); - // w.mount(div).catch(() => steps.push("1 catch")); - // await nextTick(); - // expect(fixture.innerHTML).toBe("
"); - // w.mount(span).then(() => steps.push("2 resolved")); - // // we wait two microticks because this is the number of internal promises - // // that need to be resolved/rejected, and because we want to prove here - // // that the first mount operation is cancelled immediately, and not after - // // one full tick. - // await nextMicroTick(); - // await nextMicroTick(); - // expect(steps).toEqual([]); - // await nextTick(); - // expect(fixture.innerHTML).toBe("
"); - // def.resolve(); - // await nextTick(); - // expect(steps).toEqual(["2 resolved"]); - // expect(fixture.innerHTML).toBe("
Hey
"); - }); - - test("component can be mounted on same target, another situation", async () => { - // const def = makeDeferred(); - // const steps: string[] = []; - // class MyWidget extends Component { - // static template = xml`
Hey
`; - // async willStart() { - // return def; - // } - // patched() { - // throw new Error("patched should not be called"); - // } - // } - // const w = new MyWidget(); - // w.mount(fixture).then(() => steps.push("1 resolved")); - // await nextTick(); - // expect(fixture.innerHTML).toBe(""); - // w.mount(fixture).then(() => steps.push("2 resolved")); - // await nextTick(); - // expect(steps).toEqual([]); - // expect(fixture.innerHTML).toBe(""); - // def.resolve(); - // await nextTick(); - // expect(fixture.innerHTML).toBe("
Hey
"); - // expect(steps).toEqual(["1 resolved", "2 resolved"]); - }); -}); - describe("support svg components", () => { test("add proper namespace to svg", async () => { class GComp extends Component {