mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
use snapshot testing
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`can be rendered 1`] = `
|
||||
"<div class=\\"o_navbar\\">
|
||||
<span class=\\"title\\">Odoo</span>
|
||||
<ul>
|
||||
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`can render one menu item 1`] = `
|
||||
"<div class=\\"o_navbar\\">
|
||||
<span class=\\"title\\">Odoo</span>
|
||||
<ul>
|
||||
<li>
|
||||
<a href=\\"\\">
|
||||
menu
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
@@ -0,0 +1,10 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`can be rendered 1`] = `
|
||||
"<div class=\\"o_notification\\">
|
||||
|
||||
<div class=\\"o_notification_title\\">title</div>
|
||||
<div class=\\"o_notification_content\\">message</div>
|
||||
|
||||
</div>"
|
||||
`;
|
||||
@@ -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(`
|
||||
<div class=\"o_navbar\">
|
||||
<span class=\"title\">Odoo</span>
|
||||
<ul></ul>
|
||||
</div>`)
|
||||
);
|
||||
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(`
|
||||
<div class=\"o_navbar\">
|
||||
<span class=\"title\">Odoo</span>
|
||||
<ul>
|
||||
<li><ahref=\"\">menu</a></li>
|
||||
</ul>
|
||||
</div>`)
|
||||
);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -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(`
|
||||
<div class=\"o_notification\">
|
||||
<div class=\"o_notification_title\">title</div>
|
||||
<div class=\"o_notification_content\">message</div>
|
||||
</div>`)
|
||||
);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("can be closed by clicking on it (if sticky)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user