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.
34 lines
572 B
34 lines
572 B
7 years ago
|
import Store from '../../../../store.js';
|
||
|
|
||
|
class MyStore extends Store {
|
||
|
setName(name) {
|
||
|
this.set({ name });
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const store = new MyStore({
|
||
|
name: 'world'
|
||
|
});
|
||
|
|
||
|
export default {
|
||
|
store,
|
||
|
|
||
|
html: `
|
||
|
<h1>Hello world!</h1>
|
||
|
<input>
|
||
|
`,
|
||
|
|
||
|
test(assert, component, target, window) {
|
||
|
const input = target.querySelector('input');
|
||
|
const event = new window.Event('input');
|
||
|
|
||
|
input.value = 'everybody';
|
||
|
input.dispatchEvent(event);
|
||
|
|
||
|
assert.equal(store.get('name'), 'everybody');
|
||
|
assert.htmlEqual(target.innerHTML, `
|
||
|
<h1>Hello everybody!</h1>
|
||
|
<input>
|
||
|
`);
|
||
|
}
|
||
|
};
|