mirror of
https://github.com/maputnik/editor.git
synced 2026-02-07 13:10:01 +00:00
62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
import { then } from "@shellygo/cypress-test-utils/assertable";
|
|
import MaputnikDriver from "./maputnik-driver";
|
|
|
|
describe("keyboard", () => {
|
|
let { beforeAndAfter, given, when, get } = new MaputnikDriver();
|
|
beforeAndAfter();
|
|
describe("shortcuts", () => {
|
|
beforeEach(() => {
|
|
given.setupMockBackedResponses();
|
|
when.setStyle("");
|
|
});
|
|
|
|
it("ESC should unfocus", () => {
|
|
const targetSelector = "maputnik-select";
|
|
when.focus(targetSelector);
|
|
then(get.elementByTestId(targetSelector)).shouldBeFocused();
|
|
when.typeKeys("{esc}");
|
|
then(get.elementByTestId(targetSelector)).shouldNotBeFocused();
|
|
});
|
|
|
|
it("'?' should show shortcuts modal", () => {
|
|
when.typeKeys("?");
|
|
then(get.elementByTestId("modal:shortcuts")).shouldBeVisible();
|
|
});
|
|
|
|
it("'o' should show open modal", () => {
|
|
when.typeKeys("o");
|
|
then(get.elementByTestId("modal:open")).shouldBeVisible();
|
|
});
|
|
|
|
it("'e' should show export modal", () => {
|
|
when.typeKeys("e");
|
|
then(get.elementByTestId("modal:export")).shouldBeVisible();
|
|
});
|
|
|
|
it("'d' should show sources modal", () => {
|
|
when.typeKeys("d");
|
|
then(get.elementByTestId("modal:sources")).shouldBeVisible();
|
|
});
|
|
|
|
it("'s' should show settings modal", () => {
|
|
when.typeKeys("s");
|
|
then(get.elementByTestId("modal:settings")).shouldBeVisible();
|
|
});
|
|
|
|
it("'i' should change map to inspect mode", () => {
|
|
when.typeKeys("i");
|
|
then(get.inputValue("maputnik-select")).shouldEqual("inspect");
|
|
});
|
|
|
|
it("'m' should focus map", () => {
|
|
when.typeKeys("m");
|
|
then(get.canvas()).shouldBeFocused();
|
|
});
|
|
|
|
it("'!' should show debug modal", () => {
|
|
when.typeKeys("!");
|
|
then(get.elementByTestId("modal:debug")).shouldBeVisible();
|
|
});
|
|
});
|
|
});
|