mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 17:31:14 +01:00
e34c1ca4be
It required converting mocha tests code into async since [@wdio/sync is deprecated](https://webdriver.io/docs/sync-vs-async/) starting with node v16. It removed the dependency on fibers and on [node-gyp + python](https:// webdriver.io/docs/sync-vs-async/#common-issues-in-sync-mode) indirectly though which is a great thing. Also moved away from node-sass to sass since [node-sass is deprecated] (https://sass-lang.com/blog/libsass-is-deprecated).
112 lines
2.6 KiB
JavaScript
112 lines
2.6 KiB
JavaScript
var assert = require("assert");
|
|
var config = require("../../config/specs");
|
|
var helper = require("../helper");
|
|
|
|
|
|
|
|
describe("history", function() {
|
|
let undoKeyCombo;
|
|
let undoKeyComboReset;
|
|
let redoKeyCombo;
|
|
let redoKeyComboReset;
|
|
|
|
before(async function() {
|
|
const isMac = await browser.execute(function() {
|
|
return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
});
|
|
undoKeyCombo = ['Meta', 'z'];
|
|
undoKeyComboReset = ['Meta'];
|
|
redoKeyCombo = isMac ? ['Meta', 'Shift', 'z'] : ['Meta', 'y'];
|
|
redoKeyComboReset = isMac ? ['Meta', 'Shift'] : ['Meta'];
|
|
});
|
|
|
|
/**
|
|
* See <https://github.com/webdriverio/webdriverio/issues/1126>
|
|
*/
|
|
it.skip("undo/redo", async function() {
|
|
var styleObj;
|
|
|
|
await browser.url(config.baseUrl+"?debug&style="+helper.getStyleUrl([
|
|
"geojson:example"
|
|
]));
|
|
await browser.acceptAlert();
|
|
|
|
await helper.modal.addLayer.open();
|
|
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, []);
|
|
|
|
await helper.modal.addLayer.fill({
|
|
id: "step 1",
|
|
type: "background"
|
|
})
|
|
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, [
|
|
{
|
|
"id": "step 1",
|
|
"type": 'background'
|
|
}
|
|
]);
|
|
|
|
await helper.modal.addLayer.open();
|
|
await helper.modal.addLayer.fill({
|
|
id: "step 2",
|
|
type: "background"
|
|
})
|
|
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, [
|
|
{
|
|
"id": "step 1",
|
|
"type": 'background'
|
|
},
|
|
{
|
|
"id": "step 2",
|
|
"type": 'background'
|
|
}
|
|
]);
|
|
|
|
await browser.keys(undoKeyCombo)
|
|
await browser.keys(undoKeyComboReset);
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, [
|
|
{
|
|
"id": "step 1",
|
|
"type": 'background'
|
|
}
|
|
]);
|
|
|
|
await browser.keys(undoKeyCombo)
|
|
await browser.keys(undoKeyComboReset);
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, [
|
|
]);
|
|
|
|
await browser.keys(redoKeyCombo)
|
|
await browser.keys(redoKeyComboReset);
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, [
|
|
{
|
|
"id": "step 1",
|
|
"type": 'background'
|
|
}
|
|
]);
|
|
|
|
await browser.keys(redoKeyCombo)
|
|
await browser.keys(redoKeyComboReset);
|
|
styleObj = await helper.getStyleStore(browser);
|
|
assert.deepEqual(styleObj.layers, [
|
|
{
|
|
"id": "step 1",
|
|
"type": 'background'
|
|
},
|
|
{
|
|
"id": "step 2",
|
|
"type": 'background'
|
|
}
|
|
]);
|
|
|
|
});
|
|
|
|
})
|