Skip to content

Commit

Permalink
add some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nichoth committed Feb 23, 2024
1 parent 1320cf5 commit 702bccc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ test('dom.waitFor', async t => {
selector: 'p'
})

t.equal(foundP!.textContent, 'testing', 'should find the element')
t.equal(foundP!.textContent, 'testing', 'should find the element by tag')

const a = document.body.appendChild(document.createElement('a'))
a.id = 'hello'
a.textContent = 'hello'

const foundA = await dom.waitFor({ selector: '#hello' })
t.ok(foundA, 'should find an element by ID')
t.equal(foundA?.textContent, 'hello', 'should find the right element by ID')

// wait a bit, then add the element
setTimeout(() => {
Expand Down

0 comments on commit 702bccc

Please sign in to comment.