Skip to content

Commit

Permalink
OpenStreetMap tiles test replaces superfluous `#map.leaflet-container…
Browse files Browse the repository at this point in the history
…` test
  • Loading branch information
Stassi committed Sep 23, 2024
1 parent 39da26c commit 3be2797
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/tutorial/quick-start/quick-start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ describe('quick-start tutorial', () => {

describe('map', () => {
describe('on initial page load', () => {
it('should display a Leaflet container', async () => {
expect(await page.$('#map.leaflet-container')).not.toBeNull()
// eslint-disable-next-line jest/prefer-lowercase-title -- official case
describe('OpenStreetMap tiles', () => {
it('should render', async () => {
const selector = '.leaflet-tile-loaded'
await page.waitForSelector(selector)

const sources: (string | null)[] = await page.$$eval(
selector,
(tiles) => tiles.map((tile) => tile.getAttribute('src')),
)

sources.forEach((source: string | null) => {
expect(source).toMatch(/^https:\/\/tile\.openstreetmap\.org\//)
})
})
})

describe('standalone popup', () => {
Expand All @@ -27,22 +40,6 @@ describe('quick-start tutorial', () => {
})
})

describe('tiles', () => {
it('should render from OpenStreetMap', async () => {
const selector = '.leaflet-tile-loaded'
await page.waitForSelector(selector)

const sources: (string | null)[] = await page.$$eval(
selector,
(tiles) => tiles.map((tile) => tile.getAttribute('src')),
)

sources.forEach((source: string | null) => {
expect(source).toMatch(/^https:\/\/tile\.openstreetmap\.org\//)
})
})
})

describe('element displays popup text on click', () => {
describe('map (element)', () => {
it('should display clicked coordinates', async () => {
Expand Down

0 comments on commit 3be2797

Please sign in to comment.