mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 15:07:41 +00:00
move then into driver
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
Assertable,
|
||||
then as baseThen,
|
||||
} from "@shellygo/cypress-test-utils/assertable";
|
||||
import { Assertable, then } from "@shellygo/cypress-test-utils/assertable";
|
||||
import CypressWrapperDriver from "./cypress-wrapper-driver";
|
||||
import ModalDriver from "./modal-driver";
|
||||
const baseUrl = "http://localhost:8888/";
|
||||
@@ -13,20 +10,17 @@ export class MaputnikAssertable<T> extends Assertable<T> {
|
||||
const obj = JSON.parse(styleItem || "");
|
||||
return obj;
|
||||
};
|
||||
shouldIncludeLocalStrorageStyle = (styleObj: Object) =>
|
||||
baseThen(
|
||||
shouldIncludeLocalStorageStyle = (styleObj: Object) =>
|
||||
then(
|
||||
cy.window().then((win) => this.getStyleFromWindow(win))
|
||||
).shouldDeepNestedInclude(styleObj);
|
||||
|
||||
shouldHaveLocalStorageStyle = (styleObj: Object) =>
|
||||
baseThen(
|
||||
then(
|
||||
cy.window().then((win) => this.getStyleFromWindow(win))
|
||||
).shouldDeepEqual(styleObj);
|
||||
}
|
||||
|
||||
export const then = (chainable: Cypress.Chainable<any>) =>
|
||||
new MaputnikAssertable(chainable);
|
||||
|
||||
export class MaputnikDriver {
|
||||
private helper = new CypressWrapperDriver();
|
||||
private modalDriver = new ModalDriver();
|
||||
@@ -38,6 +32,9 @@ export class MaputnikDriver {
|
||||
});
|
||||
};
|
||||
|
||||
public then = (chainable: Cypress.Chainable<any>) =>
|
||||
new MaputnikAssertable(chainable);
|
||||
|
||||
public given = {
|
||||
...this.helper.given,
|
||||
setupMockBackedResponses: () => {
|
||||
@@ -111,18 +108,18 @@ export class MaputnikDriver {
|
||||
) => {
|
||||
let url = "?debug";
|
||||
switch (styleProperties) {
|
||||
case "geojson":
|
||||
url += `&style=${baseUrl}geojson-style.json`;
|
||||
break;
|
||||
case "raster":
|
||||
url += `&style=${baseUrl}raster-style.json`;
|
||||
break;
|
||||
case "both":
|
||||
url += `&style=${baseUrl}geojson-raster-style.json`;
|
||||
break;
|
||||
case "layer":
|
||||
url += `&style=${baseUrl}/example-layer-style.json`;
|
||||
break;
|
||||
case "geojson":
|
||||
url += `&style=${baseUrl}geojson-style.json`;
|
||||
break;
|
||||
case "raster":
|
||||
url += `&style=${baseUrl}raster-style.json`;
|
||||
break;
|
||||
case "both":
|
||||
url += `&style=${baseUrl}geojson-raster-style.json`;
|
||||
break;
|
||||
case "layer":
|
||||
url += `&style=${baseUrl}/example-layer-style.json`;
|
||||
break;
|
||||
}
|
||||
if (zoom) {
|
||||
url += `#${zoom}/41.3805/2.1635`;
|
||||
|
||||
Reference in New Issue
Block a user