mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
add basic support for mobile mode
This commit is contained in:
@@ -2,7 +2,8 @@ import {
|
||||
escape,
|
||||
htmlTrim,
|
||||
idGenerator,
|
||||
memoize
|
||||
memoize,
|
||||
debounce
|
||||
} from "../../src/ts/core/utils";
|
||||
|
||||
describe("escape", () => {
|
||||
@@ -59,3 +60,20 @@ describe("memoize", () => {
|
||||
expect(nCalls).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("debounce", () => {
|
||||
test("works as expected", () => {
|
||||
jest.useFakeTimers();
|
||||
let n = 0;
|
||||
let f = debounce(() => n++, 100);
|
||||
expect(n).toBe(0);
|
||||
f();
|
||||
expect(n).toBe(0);
|
||||
f();
|
||||
expect(n).toBe(0);
|
||||
jest.advanceTimersByTime(90);
|
||||
expect(n).toBe(0);
|
||||
jest.advanceTimersByTime(20);
|
||||
expect(n).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,3 +21,12 @@ exports[`can render one menu item 1`] = `
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`mobile mode: navbar is different 1`] = `
|
||||
"<div class=\\"o_navbar\\">
|
||||
<span class=\\"title\\">Odoo MOBILE</span>
|
||||
<ul>
|
||||
|
||||
</ul>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
@@ -34,3 +34,10 @@ test("can render one menu item", async () => {
|
||||
await navbar.mount(fixture);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test("mobile mode: navbar is different", async () => {
|
||||
env.isMobile = true;
|
||||
const navbar = new Navbar(env);
|
||||
await navbar.mount(fixture);
|
||||
expect(fixture.innerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user