[REF] tests: remove Widget common class

Bad name, and bad practice to use it. It makes tests less standalone.
This commit is contained in:
Géry Debongnie
2019-12-11 11:36:59 +01:00
committed by aab-odoo
parent 9921ae07b1
commit 97d8b3ed8c
5 changed files with 918 additions and 828 deletions
@@ -967,7 +967,7 @@ exports[`random stuff/miscellaneous snapshotting compiled code 1`] = `
exports[`random stuff/miscellaneous t-on with handler bound to dynamic argument on a t-foreach 1`] = `
"function anonymous(context, extra
) {
// Template name: \\"__template__1\\"
// Template name: \\"__template__2\\"
let utils = this.constructor.utils;
let QWeb = this.constructor;
let parent = context;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -1,4 +1,4 @@
import { Env } from "../src/component/component";
import { Env, Component } from "../src/component/component";
import { scheduler } from "../src/component/scheduler";
import { EvalContext, QWeb } from "../src/qweb/qweb";
import { CompilationContext } from "../src/qweb/compilation_context";
@@ -25,6 +25,7 @@ beforeEach(() => {
slots = Object.assign({}, QWeb.slots);
nextId = QWeb.nextId;
TEMPLATES = Object.assign({}, QWeb.TEMPLATES);
Component.scheduler.tasks = [];
});
afterEach(() => {
@@ -32,6 +33,7 @@ afterEach(() => {
QWeb.slots = slots;
QWeb.nextId = nextId;
QWeb.TEMPLATES = TEMPLATES;
Component.scheduler.tasks = [];
});
// helpers
+9 -7
View File
@@ -318,12 +318,13 @@ describe("t-set", () => {
<t t-set="v1" t-value="'after'"/>
<t t-set="v3" t-value="true"/>
<t t-raw="v2"/>
</div>`);
</div>`
);
expect(renderToString(qweb, "test")).toBe("<div><span>before</span></div>");
});
expect(renderToString(qweb, "test")).toBe("<div><span>before</span></div>");
});
test("t-set with t-value (truthy) and body", () => {
test("t-set with t-value (truthy) and body", () => {
qweb.addTemplate(
"test",
`<div>
@@ -335,10 +336,11 @@ describe("t-set", () => {
<t t-set="v1" t-value="'after'"/>
<t t-set="v3" t-value="false"/>
<t t-raw="v2"/>
</div>`);
</div>`
);
expect(renderToString(qweb, "test")).toBe("<div>Truthy</div>");
});
expect(renderToString(qweb, "test")).toBe("<div>Truthy</div>");
});
});
describe("t-if", () => {