Skip to content

Commit

Permalink
test: add spec for testing lazy loading images (#366)
Browse files Browse the repository at this point in the history
Co-authored-by: Dustin Brett <[email protected]>
  • Loading branch information
bubkoo and DustinBrett authored Feb 1, 2023
1 parent c1e4047 commit 81dd2e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/resources/images/loading.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div>
<div>
<img src="/base/test/resources/images/image.jpeg" loading="lazy" />
</div>
<span>
<img src="/base/test/resources/images/image.png" loading="lazy" />
</span>
</div>
9 changes: 8 additions & 1 deletion test/spec/special.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import '../spec/setup'
import { toPng } from '../../src'
import { delay } from '../../src/util'
import { bootstrap, renderAndCheck } from '../spec/helper'
import { assertTextRendered, bootstrap, renderAndCheck } from '../spec/helper'

describe('special cases', () => {
xit('should not crash when loading external stylesheet causes error', (done) => {
Expand Down Expand Up @@ -52,4 +52,11 @@ describe('special cases', () => {
.catch(done),
)
})

it('should caputre lazy loading images', (done) => {
bootstrap('images/loading.html', 'images/style.css')
.then(assertTextRendered(['PNG', 'JPG']))
.then(done)
.catch(done)
})
})

0 comments on commit 81dd2e9

Please sign in to comment.