Skip to content

Commit

Permalink
Implement Ahmad's M.options.announceMovement
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-lu-uw committed Nov 15, 2021
1 parent 82849d6 commit 27c4862
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/mapml-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ export class MapViewer extends HTMLElement {
projection: this.projection,
query: true,
contextMenu: true,
//Will replace with M.options.announceMoves
announceMovement: true,
announceMovement: M.options.announceMovement,
mapEl: this,
crs: M[this.projection],
zoom: this.zoom,
Expand Down
3 changes: 1 addition & 2 deletions src/web-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ export class WebMap extends HTMLMapElement {
projection: this.projection,
query: true,
contextMenu: true,
//Will replace with M.options.announceMoves
announceMovement: true,
announceMovement: M.options.announceMovement,
mapEl: this,
crs: M[this.projection],
zoom: this.zoom,
Expand Down
16 changes: 1 addition & 15 deletions test/e2e/core/announceMovement.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const playwright = require("playwright");
const playwright = require("playwright");
jest.setTimeout(50000);
(async () => {
for (const browserType of BROWSER) {
Expand All @@ -22,13 +22,6 @@ jest.setTimeout(50000);
});

test("[" + browserType + "]" + " Output values are correct during regular movement", async ()=>{
const announceMovement = await page.$eval(
"body > mapml-viewer",
(map) => map._map.announceMovement._enabled
);
if(!announceMovement){
return;
}
await page.keyboard.press("Tab");
await page.keyboard.press("ArrowUp");
await page.waitForTimeout(100);
Expand Down Expand Up @@ -61,13 +54,6 @@ jest.setTimeout(50000);
});

test("[" + browserType + "]" + " Output values are correct at bounds and bounces back", async ()=>{
const announceMovement = await page.$eval(
"body > mapml-viewer",
(map) => map._map.announceMovement._enabled
);
if(!announceMovement){
return;
}
//Zoom out to min layer bound
await page.keyboard.press("Minus");
await page.waitForTimeout(100);
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/core/debugMode.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jest.setTimeout(50000);
"xpath=//html/body/mapml-viewer >> css=div > div.leaflet-pane.leaflet-map-pane > div.leaflet-pane.leaflet-overlay-pane > svg > g",
(tile) => tile.childElementCount
);
expect(feature).toEqual(4);
expect(feature).toEqual(3);
});

test("[" + browserType + "]" + " Layer deselected then reselected", async () => {
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/mapml-viewer/mapml-viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<head>
<title>Basic Mapml-Viewer</title>
<meta charset="UTF-8">
<script>
let options = document.createElement("map-options");
options.innerHTML = '{"announceMovement":true}';
document.head.appendChild(options);
</script>
<script type="module" src="mapml-viewer.js"></script>
<style>
html {
Expand Down

0 comments on commit 27c4862

Please sign in to comment.