Skip to content

Commit bb93648

Browse files
authored
Merge pull request #221 from ahmadayubi/master
Adds delays to test to allow mapml-viewer to update before checking condition and fixes decimal places on coordinates
2 parents a3d084d + 85ca0a4 commit bb93648

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/mapml/layers/DebugLayer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export var DebugPanel = L.Layer.extend({
8989
},
9090
onRemove: function () {
9191
L.DomUtil.remove(this._title);
92-
if(this._debugContainer){
92+
if (this._debugContainer) {
9393
L.DomUtil.remove(this._debugContainer);
9494
this._map.off("mousemove", this._updateCoords);
9595
}
@@ -105,11 +105,11 @@ export var DebugPanel = L.Layer.extend({
105105
if (pointI < 0) pointI += 256;
106106
if (pointJ < 0) pointJ += 256;
107107

108-
this.debug._tileCoord.innerHTML = `tile: i: ${Math.round(pointI)}, j: ${Math.round(pointJ)}`;
109-
this.debug._mapCoord.innerHTML = `map: i: ${e.containerPoint.x}, j: ${e.containerPoint.y}`;
110-
this.debug._gcrsCoord.innerHTML = `gcrs: lon: ${e.latlng.lng.toFixed(2)}, lat: ${e.latlng.lat.toFixed(2)}`;
111-
this.debug._tcrsCoord.innerHTML = `tcrs: x:${point.x.toFixed(2)}, y:${point.y.toFixed(2)}`;
112-
this.debug._tileMatrixCoord.innerHTML = `tilematrix: column:${(point.x / 256).toFixed(2)}, row:${(point.y / 256).toFixed(2)}`;
108+
this.debug._tileCoord.innerHTML = `tile: i: ${Math.trunc(pointI)}, j: ${Math.trunc(pointJ)}`;
109+
this.debug._mapCoord.innerHTML = `map: i: ${Math.trunc(e.containerPoint.x)}, j: ${Math.trunc(e.containerPoint.y)}`;
110+
this.debug._gcrsCoord.innerHTML = `gcrs: lon: ${e.latlng.lng.toFixed(6)}, lat: ${e.latlng.lat.toFixed(6)}`;
111+
this.debug._tcrsCoord.innerHTML = `tcrs: x:${Math.trunc(point.x)}, y:${Math.trunc(point.y)}`;
112+
this.debug._tileMatrixCoord.innerHTML = `tilematrix: column:${Math.trunc(point.x / 256)}, row:${Math.trunc(point.y / 256)}`;
113113
this.debug._pcrsCoord.innerHTML = `pcrs: easting:${pcrs.x.toFixed(2)}, northing:${pcrs.y.toFixed(2)}`;
114114
},
115115

test/e2e/core/debugMode.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ jest.setTimeout(50000);
103103
);
104104

105105
expect(tile).toEqual("tile: i: 141, j: 6");
106-
expect(matrix).toEqual("tilematrix: column:3.55, row:4.02");
106+
expect(matrix).toEqual("tilematrix: column:3, row:4");
107107
expect(map).toEqual("map: i: 250, j: 250");
108-
expect(tcrs).toEqual("tcrs: x:909.00, y:1030.00");
108+
expect(tcrs).toEqual("tcrs: x:909, y:1030");
109109
expect(pcrs).toEqual("pcrs: easting:217676.00, northing:-205599.86");
110-
expect(gcrs).toEqual("gcrs: lon: -92.15, lat: 47.11");
110+
expect(gcrs).toEqual("gcrs: lon: -92.152897, lat: 47.114275");
111111
});
112112

113113
test("[" + browserType + "]" + " Layer disabled attribute update when controls are toggled off", async () => {

test/e2e/core/mapContextMenu.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jest.setTimeout(50000);
8989
await page.waitForTimeout(1000);
9090
await page.click("body > map", { button: "right" });
9191
await page.click("div > div.mapml-contextmenu > a:nth-child(1)");
92+
await page.waitForTimeout(1000);
9293
const extent = await page.$eval(
9394
"body > map",
9495
(map) => map.extent
@@ -104,6 +105,7 @@ jest.setTimeout(50000);
104105
test("[" + browserType + "]" + " Context menu, back item at intial location", async () => {
105106
await page.click("body > map", { button: "right" });
106107
await page.click("div > div.mapml-contextmenu > a:nth-child(1)");
108+
await page.waitForTimeout(1000);
107109
const extent = await page.$eval(
108110
"body > map",
109111
(map) => map.extent
@@ -119,6 +121,7 @@ jest.setTimeout(50000);
119121
test("[" + browserType + "]" + " Context menu, forward item", async () => {
120122
await page.click("body > map", { button: "right" });
121123
await page.click("div > div.mapml-contextmenu > a:nth-child(2)");
124+
await page.waitForTimeout(1000);
122125
const extent = await page.$eval(
123126
"body > map",
124127
(map) => map.extent
@@ -133,6 +136,7 @@ jest.setTimeout(50000);
133136
test("[" + browserType + "]" + " Context menu, forward item at most recent location", async () => {
134137
await page.click("body > map", { button: "right" });
135138
await page.click("div > div.mapml-contextmenu > a:nth-child(2)");
139+
await page.waitForTimeout(1000);
136140
const extent = await page.$eval(
137141
"body > map",
138142
(map) => map.extent

test/e2e/mapml-viewer/viewerContextMenu.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ jest.setTimeout(50000);
8989
await page.waitForTimeout(1000);
9090
await page.click("body > mapml-viewer", { button: "right" });
9191
await page.click("div > div.mapml-contextmenu > a:nth-child(1)");
92+
await page.waitForTimeout(1000);
9293
const extent = await page.$eval(
9394
"body > mapml-viewer",
9495
(map) => map.extent
@@ -104,6 +105,7 @@ jest.setTimeout(50000);
104105
test("[" + browserType + "]" + " Context menu, back item at intial location", async () => {
105106
await page.click("body > mapml-viewer", { button: "right" });
106107
await page.click("div > div.mapml-contextmenu > a:nth-child(1)");
108+
await page.waitForTimeout(1000);
107109
const extent = await page.$eval(
108110
"body > mapml-viewer",
109111
(map) => map.extent
@@ -119,6 +121,7 @@ jest.setTimeout(50000);
119121
test("[" + browserType + "]" + " Context menu, forward item", async () => {
120122
await page.click("body > mapml-viewer", { button: "right" });
121123
await page.click("div > div.mapml-contextmenu > a:nth-child(2)");
124+
await page.waitForTimeout(1000);
122125
const extent = await page.$eval(
123126
"body > mapml-viewer",
124127
(map) => map.extent
@@ -133,6 +136,7 @@ jest.setTimeout(50000);
133136
test("[" + browserType + "]" + " Context menu, forward item at most recent location", async () => {
134137
await page.click("body > mapml-viewer", { button: "right" });
135138
await page.click("div > div.mapml-contextmenu > a:nth-child(2)");
139+
await page.waitForTimeout(1000);
136140
const extent = await page.$eval(
137141
"body > mapml-viewer",
138142
(map) => map.extent

0 commit comments

Comments
 (0)