Skip to content

Commit

Permalink
test red circle popup on click
Browse files Browse the repository at this point in the history
  • Loading branch information
Stassi committed Sep 20, 2024
1 parent 143bf9c commit ac48eb7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/tutorial/quick-start/quick-start.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// noinspection JSUnresolvedReference
import { type ElementHandle } from 'puppeteer'

describe('quick-start tutorial', () => {
beforeAll(async () => {
Expand All @@ -18,4 +19,22 @@ describe('quick-start tutorial', () => {
await page.$eval(leafletPopupContent, ({ textContent }) => textContent),
).toBe('I am a standalone popup.')
})

it('should display popup with text "I am a circle." when red circle is clicked', async () => {
const circle: ElementHandle<SVGPathElement> | null = await page.$(
'path.leaflet-interactive[stroke="red"]',
)
if (!circle) throw new Error('Circle element not found')
await circle.click()

await page.waitForFunction(
() =>
document.querySelector('.leaflet-popup-content')?.textContent ===
'I am a circle.',
)

expect(
await page.$eval('.leaflet-popup-content', (el) => el.textContent),
).toBe('I am a circle.')
})
})

0 comments on commit ac48eb7

Please sign in to comment.