import Store from '../../../../store.js'; class MyStore extends Store { setFilter(filter) { this.set({ filter }); } toggleTodo(todo) { todo.done = !todo.done; this.set({ todos: this.get('todos') }); } } const todos = [ { description: 'Buy some milk', done: true, }, { description: 'Do the laundry', done: true, }, { description: "Find life's true purpose", done: false, } ]; const store = new MyStore({ filter: 'all', todos }); export default { store, html: `
Buy some milk
Do the laundry
Find life's true purpose
`, test(assert, component, target) { store.setFilter('pending'); assert.htmlEqual(target.innerHTML, `
Find life's true purpose
`); store.toggleTodo(todos[1]); assert.htmlEqual(target.innerHTML, `
Do the laundry
Find life's true purpose
`); store.setFilter('done'); assert.htmlEqual(target.innerHTML, `
Buy some milk
`); } };