mirror of
https://github.com/maputnik/editor.git
synced 2026-04-06 17:40:02 +00:00
Fix a few typos identified with codespell. ## Launch Checklist - [X] Briefly describe the changes in this PR. - [ ] Link to related issues. - [ ] Write tests for all new functionality. - [ ] Add an entry to `CHANGELOG.md` under the `## main` section.
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { v1 as uuid } from "uuid";
|
|
import MaputnikCypressHelper from "./maputnik-cypress-helper";
|
|
|
|
export default class ModalDriver {
|
|
private helper = new MaputnikCypressHelper();
|
|
|
|
public when = {
|
|
fillLayers: (opts: { type: string; layer?: string; id?: string }) => {
|
|
// Having logic in test code is an anti pattern.
|
|
// This should be split to multiple single responsibility functions
|
|
const type = opts.type;
|
|
const layer = opts.layer;
|
|
let id;
|
|
if (opts.id) {
|
|
id = opts.id;
|
|
} else {
|
|
id = `${type}:${uuid()}`;
|
|
}
|
|
this.helper.when.selectOption("add-layer.layer-type.select", type);
|
|
this.helper.when.type("add-layer.layer-id.input", id);
|
|
|
|
if (layer) {
|
|
this.helper.when.doWithin(() => {
|
|
this.helper.get.element("input").clear().type(layer!);
|
|
}, "add-layer.layer-source-block");
|
|
}
|
|
this.helper.when.click("add-layer");
|
|
|
|
return id;
|
|
},
|
|
|
|
open: () => {
|
|
this.helper.when.click("layer-list:add-layer");
|
|
},
|
|
|
|
close: (key: string) => {
|
|
this.helper.when.click(key + ".close-modal");
|
|
},
|
|
};
|
|
}
|