Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/mapml/handlers/AnnounceMovement.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ export var AnnounceMovement = L.Handler.extend({
this._map.options.mapEl.removeEventListener('mapfocused', this.focusAnnouncement);
},

focusAnnouncement: function () {
focusAnnouncement: function () {
let mapEl = this;
setTimeout(function (){
let el = mapEl.querySelector(".mapml-web-map") ? mapEl.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container") :
mapEl.shadowRoot.querySelector(".leaflet-container");

let mapZoom = mapEl._map.getZoom();
let location = M._gcrsToTileMatrix(mapEl);
let standard = M.options.locale.amZoom + " " + mapZoom + " " + M.options.locale.amColumn + " " + location[0] + " " + M.options.locale.amRow + " " + location[1];

let standard = M.options.locale.amZoom + " " + mapZoom;
if(mapZoom === mapEl._map._layersMaxZoom){
standard = M.options.locale.amMaxZoom + " " + standard;
}
Expand Down Expand Up @@ -62,7 +62,7 @@ export var AnnounceMovement = L.Handler.extend({

//GCRS to TileMatrix
let location = M._gcrsToTileMatrix(this);
let standard = M.options.locale.amZoom + " " + mapZoom + " " + M.options.locale.amColumn + " " + location[0] + " " + M.options.locale.amRow + " " + location[1];
let standard = M.options.locale.amZoom + " " + mapZoom;

if(!visible){
let outOfBoundsPos = this._history[this._historyIndex];
Expand Down
34 changes: 28 additions & 6 deletions test/e2e/core/announceMovement.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test.describe("Announce movement test", ()=> {
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(movedUp).toEqual("zoom level 0 column 3 row 3");
expect(movedUp).toEqual("zoom level 0");

for(let i = 0; i < 2; i++){
await page.keyboard.press("ArrowLeft");
Expand All @@ -34,7 +34,7 @@ test.describe("Announce movement test", ()=> {
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(movedLeft).toEqual("zoom level 0 column 2 row 3");
expect(movedLeft).toEqual("zoom level 0");

await page.keyboard.press("Equal");
await page.waitForTimeout(1000);
Expand All @@ -43,19 +43,41 @@ test.describe("Announce movement test", ()=> {
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(zoomedIn).toEqual("zoom level 1 column 4 row 6");
expect(zoomedIn).toEqual("zoom level 1");

await page.keyboard.press("Minus");
await page.waitForTimeout(1000);

const zoomedOut = await page.$eval(
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(zoomedOut).toEqual("At minimum zoom level, zoom out disabled zoom level 0");
// testing + button
await page.keyboard.press("Tab");
await page.keyboard.press("Enter");
await page.waitForTimeout(1000);

const zoomedBackIn = await page.$eval(
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(zoomedBackIn).toEqual("zoom level 1");


});

test("Output values are correct at bounds and bounces back", async ()=>{
//Zoom out to min layer bound
await page.keyboard.press("Shift+Tab");
await page.keyboard.press("Minus");
await page.waitForTimeout(1000);

const minZoom = await page.$eval(
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(minZoom).toEqual("At minimum zoom level, zoom out disabled zoom level 0 column 2 row 3");
expect(minZoom).toEqual("At minimum zoom level, zoom out disabled zoom level 0");

//Pan out of west bounds, expect the map to bounce back
for(let i = 0; i < 4; i++){
Expand All @@ -74,7 +96,7 @@ test.describe("Announce movement test", ()=> {
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(bouncedBack).toEqual("zoom level 0 column 1 row 3");
expect(bouncedBack).toEqual("zoom level 0");

//Zoom in out of bounds, expect the map to zoom back
await page.keyboard.press("Equal");
Expand All @@ -90,7 +112,7 @@ test.describe("Announce movement test", ()=> {
"body > mapml-viewer div > output",
(output) => output.innerHTML
);
expect(zoomedBack).toEqual("zoom level 0 column 1 row 3");
expect(zoomedBack).toEqual("zoom level 0");

});
});