mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
519 B
28 lines
519 B
4 years ago
|
let value;
|
||
|
let called = 0;
|
||
|
function callback(_value) {
|
||
|
called ++;
|
||
|
value = _value;
|
||
|
}
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
|
callback,
|
||
|
},
|
||
|
async test({ assert, component, target, window }) {
|
||
|
assert.equal(called, 1);
|
||
|
|
||
|
const input = target.querySelector('input');
|
||
|
|
||
|
const event = new window.Event('input');
|
||
|
input.value = 'h';
|
||
|
await input.dispatchEvent(event);
|
||
|
|
||
|
assert.equal(called, 2);
|
||
|
assert.equal(value.length, 3);
|
||
|
assert.equal(value[0], 'h');
|
||
|
assert.equal(value[1], '2');
|
||
|
assert.equal(value[2], '3');
|
||
|
}
|
||
|
};
|