mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REM] remove some outdated tests
This commit is contained in:
committed by
Aaron Bohy
parent
aecc320c29
commit
cb107cef7d
@@ -15,13 +15,6 @@ describe("t-call (template calling)", () => {
|
|||||||
expect(context.renderToString("caller")).toBe("<div><span>ok</span></div>");
|
expect(context.renderToString("caller")).toBe("<div><span>ok</span></div>");
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip("t-call, global templates", () => {
|
|
||||||
// QWeb.registerTemplate("abcd", '<div><t t-call="john"/></div>');
|
|
||||||
// qweb.addTemplate("john", `<span>desk</span>`);
|
|
||||||
// const expected = "<div><span>desk</span></div>";
|
|
||||||
// expect(trim(renderToString(qweb, "abcd"))).toBe(expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("basic caller, no parent node", () => {
|
test("basic caller, no parent node", () => {
|
||||||
const context = new TestContext();
|
const context = new TestContext();
|
||||||
context.addTemplate("_basic-callee", `<span>ok</span>`);
|
context.addTemplate("_basic-callee", `<span>ok</span>`);
|
||||||
|
|||||||
@@ -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(\`<span>ChildB</span>\`);
|
|
||||||
|
|
||||||
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`] = `
|
exports[`basics has no el after creation 1`] = `
|
||||||
"function anonymous(bdom, helpers
|
"function anonymous(bdom, helpers
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -677,23 +677,6 @@ describe("basics", () => {
|
|||||||
expect(fixture.innerHTML).toBe("<div><span>hey</span></div>");
|
expect(fixture.innerHTML).toBe("<div><span>hey</span></div>");
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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`<span>ChildA</span>`;
|
|
||||||
}
|
|
||||||
class ChildB extends Component {
|
|
||||||
static template = xml`<span>ChildB</span>`;
|
|
||||||
}
|
|
||||||
class Parent extends Component {
|
|
||||||
static template = xml`<Child/>`;
|
|
||||||
static components = { Child: ChildA };
|
|
||||||
Child = ChildB;
|
|
||||||
}
|
|
||||||
await mount(Parent, fixture);
|
|
||||||
expect(fixture.innerHTML).toBe("<span>ChildB</span>");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("sub components between t-ifs", async () => {
|
test("sub components between t-ifs", async () => {
|
||||||
// this confuses the patching algorithm...
|
// this confuses the patching algorithm...
|
||||||
class Child extends Component {
|
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`<div>Hey</div>`;
|
|
||||||
// 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("<div><div>Hey</div></div><span></span>");
|
|
||||||
// await comp.__owl__.mount(span, );
|
|
||||||
// expect(fixture.innerHTML).toBe("<div></div><span><div>Hey</div></span>");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("widget can be mounted on different target, another situation", async () => {
|
|
||||||
// const def = makeDeferred();
|
|
||||||
// const steps: string[] = [];
|
|
||||||
// class MyWidget extends Component {
|
|
||||||
// static template = xml`<div>Hey</div>`;
|
|
||||||
// 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("<div></div><span></span>");
|
|
||||||
// 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("<div></div><span></span>");
|
|
||||||
// def.resolve();
|
|
||||||
// await nextTick();
|
|
||||||
// expect(steps).toEqual(["2 resolved"]);
|
|
||||||
// expect(fixture.innerHTML).toBe("<div></div><span><div>Hey</div></span>");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("component can be mounted on same target, another situation", async () => {
|
|
||||||
// const def = makeDeferred();
|
|
||||||
// const steps: string[] = [];
|
|
||||||
// class MyWidget extends Component {
|
|
||||||
// static template = xml`<div>Hey</div>`;
|
|
||||||
// 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("<div>Hey</div>");
|
|
||||||
// expect(steps).toEqual(["1 resolved", "2 resolved"]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("support svg components", () => {
|
describe("support svg components", () => {
|
||||||
test("add proper namespace to svg", async () => {
|
test("add proper namespace to svg", async () => {
|
||||||
class GComp extends Component {
|
class GComp extends Component {
|
||||||
|
|||||||
Reference in New Issue
Block a user