Skip to content

Commit

Permalink
feat(option): ignores an empty return
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Dec 4, 2017
1 parent 6989fb5 commit ecb3ae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ function install (Vue, options) {
const { firestore } = this.$options
this._firestoreUnbinds = Object.create(null)
this.$firestoreRefs = Object.create(null)
if (!firestore) return
const options = typeof firestore === 'function'
? firestore.call(this, this)
? firestore.call(this)
: firestore
if (!options) return
Object.keys(options).forEach(key => {
this.$bind(key, options[key])
})
Expand Down
10 changes: 10 additions & 0 deletions test/merging.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ test('should merge two functions', () => {
c: db.collection(6)
})
})

test('ignores no return', () => {
const spy = Vue.config.errorHandler = jest.fn()
new Vue({
firestore: _ => {},
render: h => h('p', 'foo')
})
expect(spy).not.toHaveBeenCalled()
spy.mockRestore()
})

0 comments on commit ecb3ae4

Please sign in to comment.