Skip to content

Commit 28df9a0

Browse files
committed
pass e2e tests, improve error stack
1 parent 7775e5c commit 28df9a0

File tree

12 files changed

+62
-42
lines changed

12 files changed

+62
-42
lines changed

examples/chat/components/MessageSection.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default {
4242
sendMessage (e) {
4343
const text = e.target.value
4444
if (text.trim()) {
45-
this.$store.call('sendMessage', {
45+
this.$store.trigger('sendMessage', {
4646
text,
4747
thread: this.thread
4848
})

examples/chat/components/ThreadSection.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
},
4141
methods: {
4242
switchThread (id) {
43-
this.$store.call('switchThread', { id })
43+
this.$store.trigger('switchThread', { id })
4444
}
4545
}
4646
}

examples/counter/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'babel-polyfill'
12
import Vue from 'vue'
23
import Counter from './Counter.vue'
34
import store from './store'

examples/shopping-cart/components/Cart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
},
3131
methods: {
3232
checkout (products) {
33-
this.$store.call('checkout', products)
33+
this.$store.trigger('checkout', products)
3434
}
3535
}
3636
}

examples/shopping-cart/components/ProductList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
'addToCart'
2424
]),
2525
created () {
26-
this.$store.call('getAllProducts')
26+
this.$store.trigger('getAllProducts')
2727
}
2828
}
2929
</script>

examples/todomvc/components/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<input class="toggle-all"
1717
type="checkbox"
1818
:checked="allChecked"
19-
@change="toggleAll(!allChecked)">
19+
@change="toggleAll({ done: !allChecked })">
2020
<ul class="todo-list">
2121
<todo v-for="todo in filteredTodos" :todo="todo"></todo>
2222
</ul>
@@ -81,7 +81,7 @@ export default {
8181
addTodo (e) {
8282
var text = e.target.value
8383
if (text.trim()) {
84-
this.$store.call('addTodo', text)
84+
this.$store.trigger('addTodo', { text })
8585
}
8686
e.target.value = ''
8787
},

examples/todomvc/components/Todo.vue

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<input class="toggle"
55
type="checkbox"
66
:checked="todo.done"
7-
@change="toggleTodo(todo)">
7+
@change="toggleTodo({ todo: todo })">
88
<label v-text="todo.text" @dblclick="editing = true"></label>
9-
<button class="destroy" @click="deleteTodo(todo)"></button>
9+
<button class="destroy" @click="deleteTodo({ todo: todo })"></button>
1010
</div>
1111
<input class="edit"
1212
v-show="editing"
@@ -19,7 +19,10 @@
1919
</template>
2020

2121
<script>
22+
import { mapActions } from 'vuex'
23+
2224
export default {
25+
name: 'Todo',
2326
props: ['todo'],
2427
data () {
2528
return {
@@ -36,15 +39,23 @@ export default {
3639
}
3740
},
3841
methods: {
39-
toggleTodo (todo) {
40-
this.$store.call('toggleTodo', todo)
41-
},
42+
...mapActions([
43+
'editTodo',
44+
'toggleTodo',
45+
'deleteTodo'
46+
]),
4247
doneEdit (e) {
4348
const value = e.target.value.trim()
49+
const { todo } = this
4450
if (!value) {
45-
this.$store.call('deleteTodo', this.todo)
51+
this.deleteTodo({
52+
todo
53+
})
4654
} else if (this.editing) {
47-
this.$store.call('editTodo', this.todo, value)
55+
this.editTodo({
56+
todo,
57+
value
58+
})
4859
this.editing = false
4960
}
5061
},

examples/todomvc/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'babel-polyfill'
12
import Vue from 'vue'
23
import store from './vuex/store'
34
import App from './components/App.vue'

examples/todomvc/vuex/actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export const toggleAll = makeAction('TOGGLE_ALL')
66
export const clearCompleted = makeAction('CLEAR_COMPLETED')
77

88
function makeAction (type) {
9-
return ({ dispatch }, ...args) => dispatch(type, ...args)
9+
return ({ dispatch }, payload) => dispatch(type, payload)
1010
}

examples/todomvc/vuex/store.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ const state = {
1717
}
1818

1919
const mutations = {
20-
ADD_TODO (state, text) {
20+
ADD_TODO (state, { text }) {
2121
state.todos.push({
22-
text: text,
22+
text,
2323
done: false
2424
})
2525
},
2626

27-
DELETE_TODO (state, todo) {
27+
DELETE_TODO (state, { todo }) {
2828
state.todos.splice(state.todos.indexOf(todo), 1)
2929
},
3030

31-
TOGGLE_TODO (state, todo) {
31+
TOGGLE_TODO (state, { todo }) {
3232
todo.done = !todo.done
3333
},
3434

35-
EDIT_TODO (state, todo, text) {
36-
todo.text = text
35+
EDIT_TODO (state, { todo, value }) {
36+
todo.text = value
3737
},
3838

39-
TOGGLE_ALL (state, done) {
39+
TOGGLE_ALL (state, { done }) {
4040
state.todos.forEach((todo) => {
4141
todo.done = done
4242
})

0 commit comments

Comments
 (0)