Skip to content

Commit 3be0d85

Browse files
Extra test case for issue #75 test
1 parent f5d50e8 commit 3be0d85

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

test/index.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -1015,19 +1015,28 @@ test("Watch as array with more then one value", t => {
10151015
})
10161016

10171017
test("$asyncComputed[name].state resolves to 'success' even if the computed value is 0 (issue #75)", t => {
1018-
t.plan(11)
1018+
t.plan(13)
10191019
const vm = new Vue({
1020+
computed: {
1021+
isUpdating () {
1022+
return this.$asyncComputed.a.updating
1023+
}
1024+
},
10201025
asyncComputed: {
1021-
a () {
1022-
return Promise.resolve(0)
1023-
},
1026+
a: {
1027+
async get () {
1028+
return 0
1029+
},
1030+
default: null
1031+
}
10241032
}
10251033
})
10261034
t.equal(vm.$asyncComputed['a'].state, 'updating')
10271035
t.equal(vm.$asyncComputed['a'].updating, true)
10281036
t.equal(vm.$asyncComputed['a'].success, false)
10291037
t.equal(vm.$asyncComputed['a'].error, false)
10301038
t.equal(vm.$asyncComputed['a'].exception, null)
1039+
t.equal(vm.isUpdating, true)
10311040

10321041
Vue.nextTick(() => {
10331042
t.equal(vm.a, 0)
@@ -1036,5 +1045,6 @@ test("$asyncComputed[name].state resolves to 'success' even if the computed valu
10361045
t.equal(vm.$asyncComputed['a'].success, true)
10371046
t.equal(vm.$asyncComputed['a'].error, false)
10381047
t.equal(vm.$asyncComputed['a'].exception, null)
1048+
t.equal(vm.isUpdating, false)
10391049
})
10401050
})

0 commit comments

Comments
 (0)