mirror of
https://github.com/maputnik/editor.git
synced 2025-12-06 06:10:00 +00:00
Co-authored-by: shelly_goldblit <shelly_goldblit@dell.com> Co-authored-by: HarelM <harel.mazor@gmail.com>
91 lines
1.9 KiB
TypeScript
91 lines
1.9 KiB
TypeScript
import { MaputnikDriver } from "./maputnik-driver";
|
|
|
|
describe("history", () => {
|
|
let { 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";
|
|
});
|
|
|
|
it("undo/redo", () => {
|
|
when.setStyle("geojson");
|
|
when.modal.open();
|
|
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({ layers: [] });
|
|
|
|
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",
|
|
},
|
|
],
|
|
});
|
|
});
|
|
});
|