Skip to content

Commit f5d50e8

Browse files
Add test for issue #75
1 parent 4e9192a commit f5d50e8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/index.js

+25
Original file line numberDiff line numberDiff line change
@@ -1013,3 +1013,28 @@ test("Watch as array with more then one value", t => {
10131013
})
10141014
})
10151015
})
1016+
1017+
test("$asyncComputed[name].state resolves to 'success' even if the computed value is 0 (issue #75)", t => {
1018+
t.plan(11)
1019+
const vm = new Vue({
1020+
asyncComputed: {
1021+
a () {
1022+
return Promise.resolve(0)
1023+
},
1024+
}
1025+
})
1026+
t.equal(vm.$asyncComputed['a'].state, 'updating')
1027+
t.equal(vm.$asyncComputed['a'].updating, true)
1028+
t.equal(vm.$asyncComputed['a'].success, false)
1029+
t.equal(vm.$asyncComputed['a'].error, false)
1030+
t.equal(vm.$asyncComputed['a'].exception, null)
1031+
1032+
Vue.nextTick(() => {
1033+
t.equal(vm.a, 0)
1034+
t.equal(vm.$asyncComputed['a'].state, 'success')
1035+
t.equal(vm.$asyncComputed['a'].updating, false)
1036+
t.equal(vm.$asyncComputed['a'].success, true)
1037+
t.equal(vm.$asyncComputed['a'].error, false)
1038+
t.equal(vm.$asyncComputed['a'].exception, null)
1039+
})
1040+
})

0 commit comments

Comments
 (0)