Skip to content

Commit f2f076c

Browse files
committed
Added tests for the top left control buttons
1 parent 81e6525 commit f2f076c

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,47 @@ test.describe('<mapml-viewer> localization tests', () => {
169169
for (const [language, locale] of locales) {
170170
// select the current map
171171
const map = await page.getByTestId(language);
172+
173+
// zoom in
174+
const zoomIn = await map.locator('.leaflet-control-zoom-in');
175+
const zoomInText = await zoomIn.getAttribute('title');
176+
expect(zoomInText).toBeTruthy();
177+
expect(zoomInText).toBe(locale.btnZoomIn);
178+
179+
// zoom out
180+
const zoomOut = await map.locator('.leaflet-control-zoom-out');
181+
const zoomOutText = await zoomOut.getAttribute('title');
182+
expect(zoomOutText).toBeTruthy();
183+
expect(zoomOutText).toBe(locale.btnZoomOut);
184+
185+
// reload
186+
const reload = await map.locator('.mapml-reload-button.mapml-button');
187+
const reloadText = await reload.getAttribute('title');
188+
expect(reloadText).toBeTruthy();
189+
expect(reloadText).toBe(locale.cmReload);
190+
191+
// fullscreen
192+
const fullscreen = await map.locator(
193+
'.leaflet-control-fullscreen-button.leaflet-bar-part'
194+
);
195+
const fullscreenText = await fullscreen.getAttribute('title');
196+
expect(fullscreenText).toBeTruthy();
197+
expect(fullscreenText).toBe(locale.btnFullScreen);
198+
199+
// click fullscreen button
200+
await fullscreen.click();
201+
202+
// exit fullscreen
203+
// await expect(fullscreen).toHaveAttribute('title', locale.btnExitFullScreen);
204+
// await page.waitForTimeout(5000);
205+
// const exitFullscreen = await map.locator(
206+
// '.leaflet-control-fullscreen-button.leaflet-bar-part'
207+
// );
208+
// const exitFullscreenText = await exitFullscreen.getAttribute('title');
209+
// expect(exitFullscreenText).toBeTruthy();
210+
// expect(exitFullscreenText).toBe(locale.btnExitFullScreen);
211+
212+
await fullscreen.click();
172213
}
173214
});
174215

0 commit comments

Comments
 (0)