mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
small refactoring...
This commit is contained in:
@@ -5,6 +5,7 @@ exports[`can be rendered 1`] = `
|
||||
<a aria-label=\\"Applications\\" class=\\"o_title fa fa-th\\" href=\\"#\\" title=\\"Applications\\" accesskey=\\"h\\"></a>
|
||||
<ul>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
@@ -18,6 +19,7 @@ exports[`can render one menu item 1`] = `
|
||||
menu
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
@@ -27,6 +29,7 @@ exports[`mobile mode: navbar is different 1`] = `
|
||||
<a aria-label=\\"Applications\\" class=\\"o_title fa fa-th\\" href=\\"#\\" title=\\"Applications\\" accesskey=\\"h\\"></a>
|
||||
<ul>
|
||||
|
||||
<li>MOBILEMODE</li>
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
@@ -13,7 +13,7 @@ let props: Props;
|
||||
beforeEach(() => {
|
||||
fixture = makeTestFixture();
|
||||
env = makeTestEnv();
|
||||
props = { inMenu: false, toggleHomeMenu: () => {} };
|
||||
props = { inMenu: false, toggleHome: () => {} };
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -42,19 +42,21 @@ test("can be rendered", async () => {
|
||||
});
|
||||
|
||||
test("can be closed by clicking on it (if sticky)", async () => {
|
||||
let notif: INotification;
|
||||
let removed = false;
|
||||
env.notifications.on("notification_added", null, _notif => (notif = _notif));
|
||||
let notifs: INotification[] = [];
|
||||
env.notifications.on(
|
||||
"notifications_updated",
|
||||
null,
|
||||
_notifs => (notifs = _notifs)
|
||||
);
|
||||
env.notifications.add({
|
||||
title: "title",
|
||||
message: "message",
|
||||
sticky: true
|
||||
});
|
||||
env.notifications.on("notification_removed", null, () => (removed = true));
|
||||
|
||||
const navbar = new Notification(env, notif!);
|
||||
const navbar = new Notification(env, notifs[0]);
|
||||
await navbar.mount(fixture);
|
||||
expect(removed).toBe(false);
|
||||
expect(notifs.length).toBe(1);
|
||||
(<any>fixture.getElementsByClassName("o_close")[0]).click();
|
||||
expect(removed).toBe(true);
|
||||
expect(notifs.length).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user