Skip to content

Commit f778cd8

Browse files
author
Guillaume Chau
committed
chore(dev): vuex test cases
1 parent f664d9e commit f778cd8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

shells/dev/target/Counter.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
>
6565
Add dynamic nested module
6666
</button>
67+
<button
68+
:disabled="$store.state.dynamic && $store.state.dynamic.nested"
69+
@click="addDynamicNestedModule(true)"
70+
>
71+
Add dynamic nested module (force)
72+
</button>
6773
<button
6874
:disabled="!$store.state.dynamic || !$store.state.dynamic.nested"
6975
@click="toggleDynamicNested()"
@@ -76,6 +82,9 @@
7682
>
7783
Remove dynamic nested module
7884
</button>
85+
<button @click="addWrongModule()">
86+
Register wrong module
87+
</button>
7988
</div>
8089

8190
<pre>{{ $store.state.instant }}</pre>
@@ -110,6 +119,10 @@ export default {
110119
}
111120
})
112121
console.log('registered instant')
122+
123+
this.addDynamicNestedModule(true)
124+
this.removeDynamicNestedModule()
125+
this.removeDynamicModule()
113126
},
114127
computed: {
115128
test () { return 1 },
@@ -166,7 +179,10 @@ export default {
166179
this.$store.commit('dynamic/TOGGLE')
167180
},
168181
169-
addDynamicNestedModule () {
182+
addDynamicNestedModule (force = false) {
183+
if (force) {
184+
this.$store.registerModule(['dynamic'], {})
185+
}
170186
this.$store.registerModule(['dynamic', 'nested'], nested)
171187
},
172188
@@ -176,6 +192,12 @@ export default {
176192
177193
toggleDynamicNested () {
178194
this.$store.commit('dynamic/TOGGLE')
195+
},
196+
197+
addWrongModule () {
198+
this.$store.registerModule(['wrong'], {
199+
a: 1, b: 2, c: 3
200+
})
179201
}
180202
}
181203
}

0 commit comments

Comments
 (0)