mirror of
https://github.com/maputnik/editor.git
synced 2026-07-09 15:37:28 +00:00
be9456d11b
## Launch Checklist Renames the e2e test and reduces changes as a preparation step from playwright in the following PR: - #1988 This is to keep as much history as possible. <img width="1907" height="933" alt="image" src="https://github.com/user-attachments/assets/b52075b3-eb3b-45dc-93dc-8c5e9cfd35dd" /> - [x] Briefly describe the changes in this PR. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
127 lines
2.6 KiB
TypeScript
127 lines
2.6 KiB
TypeScript
import { MaputnikDriver } from "./maputnik-driver";
|
|
|
|
const test = it;
|
|
|
|
describe("history", () => {
|
|
const { beforeAndAfter, when, get, then } = new MaputnikDriver();
|
|
beforeAndAfter();
|
|
|
|
let undoKeyCombo: string;
|
|
let redoKeyCombo: string;
|
|
|
|
before(() => {
|
|
const isMac = get.isMac();
|
|
undoKeyCombo = isMac ? "{meta}z" : "{ctrl}z";
|
|
redoKeyCombo = isMac ? "{meta}{shift}z" : "{ctrl}y";
|
|
});
|
|
|
|
test("undo/redo", () => {
|
|
when.setStyle("geojson");
|
|
when.modal.open();
|
|
|
|
when.modal.fillLayers({
|
|
id: "step 1",
|
|
type: "background",
|
|
});
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
|
|
layers: [
|
|
{
|
|
id: "step 1",
|
|
type: "background",
|
|
},
|
|
],
|
|
});
|
|
|
|
when.modal.open();
|
|
when.modal.fillLayers({
|
|
id: "step 2",
|
|
type: "background",
|
|
});
|
|
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
|
|
layers: [
|
|
{
|
|
id: "step 1",
|
|
type: "background",
|
|
},
|
|
{
|
|
id: "step 2",
|
|
type: "background",
|
|
},
|
|
],
|
|
});
|
|
|
|
when.typeKeys(undoKeyCombo);
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
|
|
layers: [
|
|
{
|
|
id: "step 1",
|
|
type: "background",
|
|
},
|
|
],
|
|
});
|
|
|
|
when.typeKeys(undoKeyCombo);
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({ layers: [] });
|
|
|
|
when.typeKeys(redoKeyCombo);
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
|
|
layers: [
|
|
{
|
|
id: "step 1",
|
|
type: "background",
|
|
},
|
|
],
|
|
});
|
|
|
|
when.typeKeys(redoKeyCombo);
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
|
|
layers: [
|
|
{
|
|
id: "step 1",
|
|
type: "background",
|
|
},
|
|
{
|
|
id: "step 2",
|
|
type: "background",
|
|
},
|
|
],
|
|
});
|
|
});
|
|
|
|
test("should not redo after undo and value change", () => {
|
|
when.setStyle("geojson");
|
|
when.modal.open();
|
|
when.modal.fillLayers({
|
|
id: "step 1",
|
|
type: "background",
|
|
});
|
|
|
|
when.modal.open();
|
|
when.modal.fillLayers({
|
|
id: "step 2",
|
|
type: "background",
|
|
});
|
|
|
|
when.typeKeys(undoKeyCombo);
|
|
when.typeKeys(undoKeyCombo);
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({ layers: [] });
|
|
|
|
when.modal.open();
|
|
when.modal.fillLayers({
|
|
id: "step 3",
|
|
type: "background",
|
|
});
|
|
|
|
when.typeKeys(redoKeyCombo);
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
|
|
layers: [
|
|
{
|
|
id: "step 3",
|
|
type: "background",
|
|
},
|
|
],
|
|
});
|
|
});
|
|
});
|