Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jan 23, 2025
1 parent d33c8ae commit 28842f4
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,33 @@ export default test({
};
},

async test({ assert, target }) {
d.resolve('hello');
async test({ assert, target, component }) {
d.resolve(42);
await Promise.resolve();
await Promise.resolve();
await Promise.resolve();
await Promise.resolve();
await tick();
assert.htmlEqual(target.innerHTML, '<p>42</p>');

component.num = 2;
await Promise.resolve();
await Promise.resolve();
await Promise.resolve();
await Promise.resolve();
await tick();
assert.htmlEqual(target.innerHTML, '<p>84</p>');

d = deferred();
component.promise = d.promise;
await tick();
assert.htmlEqual(target.innerHTML, '<p>pending</p>');

d.resolve(43);
await Promise.resolve();
await Promise.resolve();
await Promise.resolve();
await tick();
assert.htmlEqual(target.innerHTML, '<p>86</p>');
}
});

0 comments on commit 28842f4

Please sign in to comment.