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.
26 lines
499 B
26 lines
499 B
6 years ago
|
import { writable } from '../../../../store.js';
|
||
|
|
||
|
const count = writable(0);
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
|
count
|
||
|
},
|
||
|
|
||
|
html: `
|
||
|
<button>+1</button>
|
||
|
`,
|
||
|
|
||
|
async test({ assert, component, target, window }) {
|
||
|
assert.equal(component.get_count(), 0);
|
||
|
|
||
|
const button = target.querySelector('button');
|
||
|
const click = new window.MouseEvent('click');
|
||
|
|
||
|
await button.dispatchEvent(click);
|
||
|
assert.equal(component.get_count(), 1);
|
||
|
|
||
|
await count.set(42);
|
||
|
assert.equal(component.get_count(), 42);
|
||
|
}
|
||
|
};
|