diff --git a/web/static/src/ts/core/qweb_vdom.ts b/web/static/src/ts/core/qweb_vdom.ts
index 2fb683e2..8e757d8b 100644
--- a/web/static/src/ts/core/qweb_vdom.ts
+++ b/web/static/src/ts/core/qweb_vdom.ts
@@ -721,7 +721,7 @@ const widgetDirective: Directive = {
ctx.addLine(`let _${dummyID}_index = c${ctx.parentNode}.length;`);
ctx.addLine(`c${ctx.parentNode}.push(_${dummyID});`);
ctx.addLine(`let def${defID};`);
- let templateID = ctx.inLoop ? `(-${widgetID} - i)` : String(widgetID);
+ let templateID = ctx.inLoop ? `String(-${widgetID} - i)` : String(widgetID);
ctx.addLine(
`let w${widgetID} = ${templateID} in context.__widget__.cmap ? context.__widget__.children[context.__widget__.cmap[${templateID}]] : false;`
);
diff --git a/web/static/tests/widgets/__snapshots__/navbar.test.ts.snap b/web/static/tests/widgets/__snapshots__/navbar.test.ts.snap
new file mode 100644
index 00000000..cb4f8e27
--- /dev/null
+++ b/web/static/tests/widgets/__snapshots__/navbar.test.ts.snap
@@ -0,0 +1,23 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`can be rendered 1`] = `
+"
"
+`;
+
+exports[`can render one menu item 1`] = `
+""
+`;
diff --git a/web/static/tests/widgets/__snapshots__/notification.test.ts.snap b/web/static/tests/widgets/__snapshots__/notification.test.ts.snap
new file mode 100644
index 00000000..a03504ac
--- /dev/null
+++ b/web/static/tests/widgets/__snapshots__/notification.test.ts.snap
@@ -0,0 +1,10 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`can be rendered 1`] = `
+""
+`;
diff --git a/web/static/tests/widgets/navbar.test.ts b/web/static/tests/widgets/navbar.test.ts
index 5e997cf8..5a8a5e3d 100644
--- a/web/static/tests/widgets/navbar.test.ts
+++ b/web/static/tests/widgets/navbar.test.ts
@@ -1,6 +1,6 @@
import { Env } from "../../src/ts/env";
-import { makeTestEnv, makeTestFixture, normalize } from "../helpers";
import { Navbar } from "../../src/ts/widgets/navbar";
+import { makeTestEnv, makeTestFixture } from "../helpers";
//------------------------------------------------------------------------------
// Setup and helpers
@@ -25,26 +25,12 @@ afterEach(() => {
test("can be rendered", async () => {
const navbar = new Navbar(env);
await navbar.mount(fixture);
- expect(normalize(fixture.innerHTML)).toBe(
- normalize(`
- `)
- );
+ expect(fixture.innerHTML).toMatchSnapshot();
});
test("can render one menu item", async () => {
env.menus.push({ title: "menu", actionID: 4 });
const navbar = new Navbar(env);
await navbar.mount(fixture);
- expect(normalize(fixture.innerHTML)).toBe(
- normalize(`
- `)
- );
+ expect(fixture.innerHTML).toMatchSnapshot();
});
diff --git a/web/static/tests/widgets/notification.test.ts b/web/static/tests/widgets/notification.test.ts
index bea56515..26d9b313 100644
--- a/web/static/tests/widgets/notification.test.ts
+++ b/web/static/tests/widgets/notification.test.ts
@@ -1,7 +1,7 @@
import { Env } from "../../src/ts/env";
-import { makeTestEnv, makeTestFixture, normalize } from "../helpers";
-import { Notification } from "../../src/ts/widgets/notification";
import { INotification } from "../../src/ts/services/notifications";
+import { Notification } from "../../src/ts/widgets/notification";
+import { makeTestEnv, makeTestFixture } from "../helpers";
//------------------------------------------------------------------------------
// Setup and helpers
@@ -38,13 +38,7 @@ test("can be rendered", async () => {
const notif = makeNotification({ title: "title", message: "message" });
const navbar = new Notification(env, notif);
await navbar.mount(fixture);
- expect(normalize(fixture.innerHTML)).toBe(
- normalize(`
- `)
- );
+ expect(fixture.innerHTML).toMatchSnapshot();
});
test("can be closed by clicking on it (if sticky)", async () => {