Skip to content

Commit 06f0e0c

Browse files
committed
Update examples
1 parent 7be6ff2 commit 06f0e0c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

examples/TodoApp.spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ test('creates a todo', async () => {
1717
expect(wrapper.findAll('[data-test="todo"]')).toHaveLength(2)
1818
})
1919

20+
test('completes a todo', async () => {
21+
const wrapper = mount(TodoApp)
22+
23+
await wrapper.find('[data-test="todo-checkbox"]').setChecked()
24+
25+
expect(wrapper.find('[data-test="todo"]').classes()).toContain('completed')
26+
})

examples/TodoApp.vue

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<template>
22
<div>
3-
<div v-for="todo in todos" :key="todo.id" data-test="todo">
3+
<div
4+
v-for="todo in todos"
5+
:key="todo.id"
6+
data-test="todo"
7+
:class="[ todo.completed ? 'completed' : '' ]"
8+
>
49
{{ todo.text }}
10+
<input
11+
type="checkbox"
12+
v-model="todo.completed"
13+
data-test="todo-checkbox"
14+
/>
515
</div>
616

717
<form data-test="form" @submit.prevent="createTodo">

0 commit comments

Comments
 (0)