Skip to content

Commit

Permalink
Extra test case for issue #75 test
Browse files Browse the repository at this point in the history
  • Loading branch information
foxbenjaminfox committed Apr 11, 2019
1 parent f5d50e8 commit 3be0d85
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,19 +1015,28 @@ test("Watch as array with more then one value", t => {
})

test("$asyncComputed[name].state resolves to 'success' even if the computed value is 0 (issue #75)", t => {
t.plan(11)
t.plan(13)
const vm = new Vue({
computed: {
isUpdating () {
return this.$asyncComputed.a.updating
}
},
asyncComputed: {
a () {
return Promise.resolve(0)
},
a: {
async get () {
return 0
},
default: null
}
}
})
t.equal(vm.$asyncComputed['a'].state, 'updating')
t.equal(vm.$asyncComputed['a'].updating, true)
t.equal(vm.$asyncComputed['a'].success, false)
t.equal(vm.$asyncComputed['a'].error, false)
t.equal(vm.$asyncComputed['a'].exception, null)
t.equal(vm.isUpdating, true)

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

0 comments on commit 3be0d85

Please sign in to comment.