import { Store } from '../../../../store.js';
const store = new Store({
name: {
value: 'world'
}
});
export default {
store,
html: `
Hello world!
`,
ssrHtml: `
Hello world!
`,
test(assert, component, target, window) {
const input = target.querySelector('input');
const event = new window.Event('input');
const changeRecord = [];
store.on('state', ({ changed, current }) => {
changeRecord.push({ changed, current });
});
input.value = 'everybody';
input.dispatchEvent(event);
assert.equal(store.get().name.value, 'everybody');
assert.htmlEqual(target.innerHTML, `
Hello everybody!
`);
assert.deepEqual(changeRecord, [
{
current: { name: { value: 'everybody' } },
changed: { name: true }
}
]);
}
};