Skip to content

Commit 1d53250

Browse files
AliyanHprushforth
authored andcommitted
Update mapFeature test after bug Fix to use Enter + Update map-Feature.test to reflect current changes/work with map-meta, also remove timeout's for now - TBD + comment out addZoomLimit - TBD
1 parent 1d6d878 commit 1d53250

File tree

4 files changed

+25
-18
lines changed

4 files changed

+25
-18
lines changed

index.html

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@
7373
</head>
7474
<body>
7575
<mapml-viewer projection="OSMTILE" zoom="10" lon="-75.7" lat="45.4" controls="">
76+
<layer- label="OpenStreetMap" src="https://maps4html.org/web-map-doc/demo/data/osm.mapml" checked=""></layer->
77+
7678
<layer- label="Polygon" checked>
7779
<map-meta name="projection" content="OSMTILE"></map-meta>
7880
<map-meta name="zoom" content="min=10,max=11"></map-meta>
7981
<map-feature zoom="10">
8082
<map-featurecaption>Click me!</map-featurecaption>
8183
<!-- Setting the geometry coordinates to gcrs, as the default is pcrs -->
82-
<map-geometry cs="gcrs">
84+
<map-geometry>
8385
<map-a href="#15, -75.699, 45.420">
8486
<map-polygon class="polygon">
8587
<map-coordinates>-75.8242035 45.3526278 -75.6793213 45.4572409 -75.5680847 45.4692806 -75.6092834 45.4215881 -75.5756378 45.3810901 -75.7946777 45.3120804</map-coordinates>
@@ -90,13 +92,12 @@
9092
</map-feature>
9193
</layer->
9294

93-
<!-- <layer- label="Points" checked>
95+
<layer- label="Points" checked>
9496
<map-meta name="projection" content="OSMTILE"></map-meta>
9597
<map-meta name="zoom" content="min=14,max=24"></map-meta>
9698
<map-feature>
9799
<map-featurecaption>Point 1</map-featurecaption>
98-
Setting the geometry coordinates to gcrs, as the default is pcrs
99-
<map-geometry cs="gcrs">
100+
<map-geometry>
100101
<map-point class="point">
101102
<map-coordinates>-75.6978285 45.4202251</map-coordinates>
102103
</map-point>
@@ -105,8 +106,7 @@
105106
</map-feature>
106107
<map-feature>
107108
<map-featurecaption>Point 2</map-featurecaption>
108-
Setting the geometry coordinates to gcrs, as the default is pcrs
109-
<map-geometry cs="gcrs">
109+
<map-geometry>
110110
<map-point class="point">
111111
<map-coordinates>-75.7002854 45.4199465</map-coordinates>
112112
</map-point>
@@ -115,14 +115,13 @@
115115
</map-feature>
116116
<map-feature>
117117
<map-featurecaption>point 3</map-featurecaption>
118-
Setting the geometry coordinates to gcrs, as the default is pcrs
119-
<map-geometry cs="gcrs">
118+
<map-geometry>
120119
<map-point class="point">
121120
<map-coordinates>-75.6984723 45.4179207</map-coordinates>
122121
</map-point>
123122
</map-geometry>
124123
<map-properties></map-properties>
125124
</map-feature>
126-
</layer->-->
125+
</layer->
127126
</mapml-viewer> </body>
128127
</html>

src/map-feature.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export class MapFeature extends HTMLElement {
229229
// todo: dynamically update layer bounds of vector layer
230230
mapmlvectors.layerBounds = M.getBounds(this._layer._content);
231231
// update map's zoom limit
232-
this._map._addZoomLimit(mapmlvectors);
232+
//this._map._addZoomLimit(mapmlvectors);
233233
// TODO: can be set as a handler of featureLayer
234234
mapmlvectors._resetFeatures();
235235
L.extend(mapmlvectors.options, mapmlvectors.zoomBounds);

test/e2e/core/featureIndexOverlayFocus.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ test.describe('Feature Index Overlay Focus tests', () => {
142142
await page.locator('#map3').getByTitle('Reload').click();
143143
});
144144
test('Feature index overlay and reticle show after following a link', async () => {
145-
await page.locator('#map3').scrollIntoViewIfNeeded();
146-
await page.locator('#map3 .leaflet-interactive.map-a').click();
145+
await page.locator('#map3').click();
146+
await page.keyboard.press('Tab');
147+
await page.keyboard.press('Enter');
147148
const afterFollowingLinkReticle = page.locator(
148149
'#map3 .mapml-feature-index-box'
149150
);

test/e2e/features/mapFeature.test.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test.describe('Playwright map-feature tests', () => {
2121
await expect(page.getByTestId('viewer')).toHaveJSProperty('zoom', '10');
2222

2323
// click the polygon link to zoom
24-
await page.getByRole('link', { name: 'Click me!' }).click({ timeout: 300 });
24+
await page.getByLabel('Click me!').click();
2525

2626
// traversing the link, expect the new map location to be centered #15, -75.699, 45.420
2727
await expect(page.getByTestId('viewer')).toHaveJSProperty('lat', '45.42');
@@ -32,15 +32,15 @@ test.describe('Playwright map-feature tests', () => {
3232
// await page.getByTestId('points').evaluate((layer)=>layer._layer._setLayerElExtent());
3333

3434
// click the first point on the map
35-
await page.getByRole('button', { name: 'Point 1' }).click({ timeout: 300 });
35+
await page.getByRole('button', { name: 'Point 1' }).click();
3636
// expect the popup for Point 1 to have specific content
3737
await page.getByRole('heading', { name: 'Point 1' });
3838
// expect the popup to have a Zoom to here link
3939
await page
4040
.getByRole('link', { name: 'Zoom to here' })
41-
.click({ timeout: 300 });
41+
.click();
4242

43-
// traversing the link, expect the new map location to be centered #14,-75.6978309903406,45.42022684737822
43+
// traversing the link, expect the new map location to be centered #24,-75.6978309903406,45.42022684737822 because it is zooming to the map-feature, and it has no map-meta value set, or a map-feature zoom attribute
4444
await expect(page.getByTestId('viewer')).toHaveJSProperty(
4545
'lat',
4646
'45.42022684737822'
@@ -49,9 +49,16 @@ test.describe('Playwright map-feature tests', () => {
4949
'lon',
5050
'-75.6978309903406'
5151
);
52-
await expect(page.getByTestId('viewer')).toHaveJSProperty('zoom', '14');
52+
await expect(page.getByTestId('viewer')).toHaveJSProperty('zoom', '24');
53+
// click the first point on the map
54+
await page.getByRole('button', { name: 'Point 1' }).click();
55+
// expect the popup for Point 1 to have specific content
56+
await page.getByRole('heading', { name: 'Point 1' });
57+
// expect the popup to have a Zoom to here link
58+
await page.getByRole('link', { name: 'Zoom to here' })
59+
// close the popup
5360
await page
5461
.getByRole('button', { name: 'Close popup' })
55-
.click({ timeout: 300 });
62+
.click();
5663
});
5764
});

0 commit comments

Comments
 (0)