import { MaputnikDriver } from "./maputnik-driver"; test.describe("keyboard", () => { const { beforeAndAfter, given, when, get, then } = new MaputnikDriver(); beforeAndAfter(); test.describe("shortcuts", () => { beforeEach(() => { given.setupMockBackedResponses(); when.setStyle(""); }); test("ESC should unfocus", () => { const targetSelector = "maputnik-select"; when.focus(targetSelector); then(get.elementByTestId(targetSelector)).shouldBeFocused(); when.typeKeys("{esc}"); then(get.elementByTestId(targetSelector)).shouldNotBeFocused(); }); test("'?' should show shortcuts modal", () => { when.typeKeys("?"); then(get.elementByTestId("modal:shortcuts")).shouldBeVisible(); }); test("'o' should show open modal", () => { when.typeKeys("o"); then(get.elementByTestId("modal:open")).shouldBeVisible(); }); test("'e' should show export modal", () => { when.typeKeys("e"); then(get.elementByTestId("modal:export")).shouldBeVisible(); }); test("'d' should show sources modal", () => { when.typeKeys("d"); then(get.elementByTestId("modal:sources")).shouldBeVisible(); }); test("'s' should show settings modal", () => { when.typeKeys("s"); then(get.elementByTestId("modal:settings")).shouldBeVisible(); }); test("'i' should change map to inspect mode", () => { when.typeKeys("i"); then(get.inputValue("maputnik-select")).shouldEqual("inspect"); }); test("'m' should focus map", () => { when.typeKeys("m"); then(get.canvas()).shouldBeFocused(); }); test("'!' should show debug modal", () => { when.typeKeys("!"); then(get.elementByTestId("modal:debug")).shouldBeVisible(); }); }); });