mirror of
https://github.com/maputnik/editor.git
synced 2026-07-08 23:17:26 +00:00
ac9186e7f8
Make the driver page-lazy (it resolves the running test's page on demand via
an auto fixture) so it can be created a single time at describe scope and
reused across the block's tests, matching the pre-migration ergonomics:
const { given, get, when, then } = new MaputnikDriver();
instead of pulling `driver` out of a fixture and destructuring it in every
test. Coverage collection and dialog handling move into the auto fixture.
Also inject a bare invalid token ("zzz") in the json-editor parse-error test:
CodeMirror auto-closes brackets/quotes, so " {" no longer reliably breaks the
JSON.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { test } from "./fixtures";
|
|
import { MaputnikDriver } from "./maputnik-driver";
|
|
|
|
test.describe("i18n", () => {
|
|
const { given, get, when, then } = new MaputnikDriver();
|
|
|
|
test.beforeEach(async () => {
|
|
await given.setupMockBackedResponses();
|
|
await when.setStyle("both");
|
|
});
|
|
|
|
test.describe("language detector", () => {
|
|
test("English", async () => {
|
|
await when.visit("?lng=en");
|
|
await then(get.elementByTestId("maputnik-lang-select")).shouldHaveValue("en");
|
|
});
|
|
|
|
test("Japanese", async () => {
|
|
await when.visit("?lng=ja");
|
|
await then(get.elementByTestId("maputnik-lang-select")).shouldHaveValue("ja");
|
|
});
|
|
});
|
|
|
|
test.describe("language switcher", () => {
|
|
test.beforeEach(async () => {
|
|
await when.setStyle("layer");
|
|
});
|
|
|
|
test("the language switcher switches to Japanese", async () => {
|
|
const selector = "maputnik-lang-select";
|
|
await then(get.elementByTestId(selector)).shouldExist();
|
|
await when.select(selector, "ja");
|
|
await then(get.elementByTestId(selector)).shouldHaveValue("ja");
|
|
|
|
await then(get.elementByTestId("nav:settings")).shouldHaveText("スタイル設定");
|
|
});
|
|
});
|
|
});
|