2019-01-29 10:46:01 +01:00
|
|
|
import { Env } from "../../src/ts/env";
|
|
|
|
|
import { Navbar } from "../../src/ts/widgets/navbar";
|
2019-01-30 10:22:24 +01:00
|
|
|
import { makeTestEnv, makeTestFixture } from "../helpers";
|
2019-01-29 10:46:01 +01:00
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
// Setup and helpers
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
let fixture: HTMLElement;
|
|
|
|
|
let env: Env;
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
fixture = makeTestFixture();
|
|
|
|
|
env = makeTestEnv();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
|
fixture.remove();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
// Tests
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
test("can be rendered", async () => {
|
|
|
|
|
const navbar = new Navbar(env);
|
|
|
|
|
await navbar.mount(fixture);
|
2019-01-30 10:22:24 +01:00
|
|
|
expect(fixture.innerHTML).toMatchSnapshot();
|
2019-01-29 10:46:01 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test("can render one menu item", async () => {
|
|
|
|
|
env.menus.push({ title: "menu", actionID: 4 });
|
|
|
|
|
const navbar = new Navbar(env);
|
|
|
|
|
await navbar.mount(fixture);
|
2019-01-30 10:22:24 +01:00
|
|
|
expect(fixture.innerHTML).toMatchSnapshot();
|
2019-01-29 10:46:01 +01:00
|
|
|
});
|
2019-01-30 12:34:45 +01:00
|
|
|
|
|
|
|
|
test("mobile mode: navbar is different", async () => {
|
|
|
|
|
env.isMobile = true;
|
|
|
|
|
const navbar = new Navbar(env);
|
|
|
|
|
await navbar.mount(fixture);
|
|
|
|
|
expect(fixture.innerHTML).toMatchSnapshot();
|
|
|
|
|
});
|