pull/16971/head
Rich Harris 1 month ago
parent c2c3fece03
commit d377df7920

@ -3,27 +3,27 @@ import { test } from '../../test';
export default test({
async test({ assert, target }) {
// We gotta wait a bit more in this test because of the macrotasks in App.svelte
function macrotask(t = 3) {
function sleep(t = 50) {
return new Promise((r) => setTimeout(r, t));
}
await macrotask();
await sleep();
assert.htmlEqual(target.innerHTML, '<input> 1 | ');
const [input] = target.querySelectorAll('input');
input.value = '1';
input.dispatchEvent(new Event('input', { bubbles: true }));
await macrotask();
await sleep();
assert.htmlEqual(target.innerHTML, '<input> 1 | ');
input.value = '12';
input.dispatchEvent(new Event('input', { bubbles: true }));
await macrotask(6);
await sleep();
assert.htmlEqual(target.innerHTML, '<input> 3 | 12');
input.value = '';
input.dispatchEvent(new Event('input', { bubbles: true }));
await macrotask();
await sleep();
assert.htmlEqual(target.innerHTML, '<input> 4 | ');
}
});

Loading…
Cancel
Save