mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { Env } from "../../src/ts/env";
|
|
import { HomeMenu, Props } from "../../src/ts/widgets/home_menu";
|
|
import { makeTestEnv, makeTestFixture, loadTemplates } from "../helpers";
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Setup and helpers
|
|
//------------------------------------------------------------------------------
|
|
|
|
let fixture: HTMLElement;
|
|
let env: Env;
|
|
let props: Props;
|
|
let templates: string;
|
|
|
|
beforeAll(async () => {
|
|
templates = await loadTemplates();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
fixture = makeTestFixture();
|
|
env = makeTestEnv();
|
|
env.qweb.loadTemplates(templates);
|
|
props = {
|
|
menuInfo: {
|
|
menuMap: {
|
|
14: {
|
|
id: 14,
|
|
name: "Demo",
|
|
parent_id: false,
|
|
action: false,
|
|
icon: "fa fa-test",
|
|
children: []
|
|
}
|
|
},
|
|
roots: [14]
|
|
}
|
|
};
|
|
});
|
|
|
|
afterEach(() => {
|
|
fixture.remove();
|
|
});
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Tests
|
|
//------------------------------------------------------------------------------
|
|
|
|
test("can be rendered", async () => {
|
|
const homeMenu = new HomeMenu(env, props);
|
|
await homeMenu.mount(fixture);
|
|
expect(fixture.innerHTML).toMatchSnapshot();
|
|
});
|