preliminary support for home menu

This commit is contained in:
Géry Debongnie
2019-01-31 10:55:41 +01:00
parent 25da2b2230
commit bac075dbbd
7 changed files with 105 additions and 41 deletions
@@ -2,7 +2,7 @@
exports[`can be rendered 1`] = `
"<div class=\\"o_navbar\\">
<span class=\\"title\\">Odoo</span>
<a aria-label=\\"Applications\\" class=\\"o_title fa fa-th\\" href=\\"#\\" title=\\"Applications\\" accesskey=\\"h\\"></a>
<ul>
</ul>
@@ -11,7 +11,7 @@ exports[`can be rendered 1`] = `
exports[`can render one menu item 1`] = `
"<div class=\\"o_navbar\\">
<span class=\\"title\\">Odoo</span>
<a aria-label=\\"Applications\\" class=\\"o_title fa fa-th\\" href=\\"#\\" title=\\"Applications\\" accesskey=\\"h\\"></a>
<ul>
<li>
<a href=\\"\\">
@@ -24,7 +24,7 @@ exports[`can render one menu item 1`] = `
exports[`mobile mode: navbar is different 1`] = `
"<div class=\\"o_navbar\\">
<span class=\\"title\\">Odoo MOBILE</span>
<a aria-label=\\"Applications\\" class=\\"o_title fa fa-th\\" href=\\"#\\" title=\\"Applications\\" accesskey=\\"h\\"></a>
<ul>
</ul>
+6 -4
View File
@@ -1,5 +1,5 @@
import { Env } from "../../src/ts/env";
import { Navbar } from "../../src/ts/widgets/navbar";
import { Navbar, Props } from "../../src/ts/widgets/navbar";
import { makeTestEnv, makeTestFixture } from "../helpers";
//------------------------------------------------------------------------------
@@ -8,10 +8,12 @@ import { makeTestEnv, makeTestFixture } from "../helpers";
let fixture: HTMLElement;
let env: Env;
let props: Props;
beforeEach(() => {
fixture = makeTestFixture();
env = makeTestEnv();
props = { inMenu: false, toggleHomeMenu: () => {} };
});
afterEach(() => {
@@ -23,21 +25,21 @@ afterEach(() => {
//------------------------------------------------------------------------------
test("can be rendered", async () => {
const navbar = new Navbar(env);
const navbar = new Navbar(env, props);
await navbar.mount(fixture);
expect(fixture.innerHTML).toMatchSnapshot();
});
test("can render one menu item", async () => {
env.menus.push({ title: "menu", actionID: 4 });
const navbar = new Navbar(env);
const navbar = new Navbar(env, props);
await navbar.mount(fixture);
expect(fixture.innerHTML).toMatchSnapshot();
});
test("mobile mode: navbar is different", async () => {
env.isMobile = true;
const navbar = new Navbar(env);
const navbar = new Navbar(env, props);
await navbar.mount(fixture);
expect(fixture.innerHTML).toMatchSnapshot();
});