Skip to content

Commit

Permalink
feat: add test specs for img with async src API.
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall committed Nov 7, 2024
1 parent 3c0c427 commit 1999438
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions integration_tests/specs/dom/elements/img.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ describe('Tags img', () => {
done();
});

it('async set property', async (done) => {
const img = createElement('img', {
src: 'assets/rabbit.png'
}) as HTMLImageElement;
BODY.appendChild(img);
// @ts-ignore
let src = await img.src_async;
expect(src).toBe(`http://localhost:${location.port}/public/assets/rabbit.png`);
// have to wait for asset load?
await snapshot(0.1);
// @ts-ignore
img.src_async = 'assets/solidblue.png';
await snapshot(0.1);
// @ts-ignore
src = await img.src_async;
expect(src).toBe(`http://localhost:${location.port}/public/assets/solidblue.png`);
done();
});

it('read image size through property', async (done) => {
const img = document.createElement('img');
img.onload = async () => {
Expand Down

0 comments on commit 1999438

Please sign in to comment.