Skip to content

Commit

Permalink
feat(refs): clear $firestoreRefs on $destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Nov 17, 2017
1 parent d7a90ee commit 250a4f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function install (Vue, options) {
unbind()
})
this._firestoreUnbinds = null
this.$firestoreRefs = null
}
})

Expand Down
8 changes: 7 additions & 1 deletion test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,15 @@ test('setups _firestoreUnbinds with no firestore options', t => {
t.deepEqual(Object.keys(vm._firestoreUnbinds), [])
})

test('setups _firestoreRefs', t => {
test('setups $firestoreRefs', t => {
const vm = t.context.vm
t.deepEqual(Object.keys(vm.$firestoreRefs).sort(), ['item', 'items'])
t.is(vm.$firestoreRefs.item, t.context.document)
t.is(vm.$firestoreRefs.items, t.context.collection)
})

test('clears $firestoreRefs on $destroy', t => {
const vm = t.context.vm
vm.$destroy()
t.deepEqual(vm.$firestoreRefs, null)
})

0 comments on commit 250a4f9

Please sign in to comment.