small refactoring...

This commit is contained in:
Géry Debongnie
2019-01-31 13:19:30 +01:00
parent bac075dbbd
commit 92bea3df52
17 changed files with 199 additions and 158 deletions
@@ -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>"
`;
+1 -1
View File
@@ -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);
});