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.
svelte/test/runtime/samples/store-auto-subscribe-in-script/_config.js

28 lines
530 B

import { writable } from 'svelte/store';
let count = writable(0);
export default {
get props() {
count = writable(0);
return { 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);
}
};