mirror of
https://github.com/maputnik/editor.git
synced 2026-07-29 01:07:26 +00:00
update keyboard tests
This commit is contained in:
+12
-12
@@ -1,7 +1,8 @@
|
|||||||
|
import { then } from "@shellygo/cypress-test-utils/assertable";
|
||||||
import MaputnikDriver from "./maputnik-driver";
|
import MaputnikDriver from "./maputnik-driver";
|
||||||
|
|
||||||
describe("keyboard", () => {
|
describe("keyboard", () => {
|
||||||
let { beforeAndAfter, given, when, should } = new MaputnikDriver();
|
let { beforeAndAfter, given, when, get } = new MaputnikDriver();
|
||||||
beforeAndAfter();
|
beforeAndAfter();
|
||||||
describe("shortcuts", () => {
|
describe("shortcuts", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -12,50 +13,49 @@ describe("keyboard", () => {
|
|||||||
it("ESC should unfocus", () => {
|
it("ESC should unfocus", () => {
|
||||||
const targetSelector = "maputnik-select";
|
const targetSelector = "maputnik-select";
|
||||||
when.focus(targetSelector);
|
when.focus(targetSelector);
|
||||||
should.beFocused(targetSelector);
|
then(get.elementByTestId(targetSelector)).shouldBeFocused();
|
||||||
|
|
||||||
when.typeKeys("{esc}");
|
when.typeKeys("{esc}");
|
||||||
expect(should.notBeFocused(targetSelector));
|
then(get.elementByTestId(targetSelector)).shouldNotBeFocused();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'?' should show shortcuts modal", () => {
|
it("'?' should show shortcuts modal", () => {
|
||||||
when.typeKeys("?");
|
when.typeKeys("?");
|
||||||
should.beVisible("modal:shortcuts");
|
then(get.elementByTestId("modal:shortcuts")).shouldBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'o' should show open modal", () => {
|
it("'o' should show open modal", () => {
|
||||||
when.typeKeys("o");
|
when.typeKeys("o");
|
||||||
should.beVisible("modal:open");
|
then(get.elementByTestId("modal:open")).shouldBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'e' should show export modal", () => {
|
it("'e' should show export modal", () => {
|
||||||
when.typeKeys("e");
|
when.typeKeys("e");
|
||||||
should.beVisible("modal:export");
|
then(get.elementByTestId("modal:export")).shouldBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'d' should show sources modal", () => {
|
it("'d' should show sources modal", () => {
|
||||||
when.typeKeys("d");
|
when.typeKeys("d");
|
||||||
should.beVisible("modal:sources");
|
then(get.elementByTestId("modal:sources")).shouldBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'s' should show settings modal", () => {
|
it("'s' should show settings modal", () => {
|
||||||
when.typeKeys("s");
|
when.typeKeys("s");
|
||||||
should.beVisible("modal:settings");
|
then(get.elementByTestId("modal:settings")).shouldBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'i' should change map to inspect mode", () => {
|
it("'i' should change map to inspect mode", () => {
|
||||||
when.typeKeys("i");
|
when.typeKeys("i");
|
||||||
should.beSelected("nav:inspect", "inspect");
|
then(get.inputValue("nav:inspect")).shouldEqual("inspect");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'m' should focus map", () => {
|
it("'m' should focus map", () => {
|
||||||
when.typeKeys("m");
|
when.typeKeys("m");
|
||||||
should.canvasBeFocused();
|
then(get.canvas()).shouldBeFocused();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("'!' should show debug modal", () => {
|
it("'!' should show debug modal", () => {
|
||||||
when.typeKeys("!");
|
when.typeKeys("!");
|
||||||
should.beVisible("modal:debug");
|
then(get.elementByTestId("modal:debug")).shouldBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ export default class MaputnikDriver {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public get = {
|
public get = {
|
||||||
|
...this.helper.get,
|
||||||
isMac: () => {
|
isMac: () => {
|
||||||
return Cypress.platform === "darwin";
|
return Cypress.platform === "darwin";
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user