mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
fix issue with actioncontainer, add tests
This commit is contained in:
@@ -30,16 +30,29 @@ afterEach(() => {
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
test("can be rendered (in home menu)", async () => {
|
||||
const navbar = new Root(env, props);
|
||||
await navbar.mount(fixture);
|
||||
const root = new Root(env, props);
|
||||
await root.mount(fixture);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("if url has action_id, will render action and navigate to proper menu_id", async () => {
|
||||
env.router.setQuery({ action_id: "595" });
|
||||
const navbar = new Root(env, props);
|
||||
await navbar.mount(fixture);
|
||||
const root = new Root(env, props);
|
||||
await root.mount(fixture);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
// we check here that the url was changed to set app id as menu_id
|
||||
expect(env.router.currentQuery).toEqual({ action_id: "595", menu_id: "409" });
|
||||
});
|
||||
|
||||
test("start with no action => clicks on client action => discuss is rendered", async () => {
|
||||
const root = new Root(env, props);
|
||||
await root.mount(fixture);
|
||||
|
||||
expect(env.router.currentQuery).toEqual({});
|
||||
|
||||
// discuss menu item
|
||||
await (<any>document.querySelector('[data-menu="96"]')).click();
|
||||
await helpers.nextTick();
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
expect(env.router.currentQuery).toEqual({ action_id: "131", menu_id: "96" });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user