Skip to content
Merged
1 change: 1 addition & 0 deletions src/vuefire.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ function ensureRefs (vm) {

var init = function () {
var bindings = this.$options.firebase
if (typeof bindings === 'function') bindings = bindings.call(this)
if (!bindings) return
ensureRefs(this)
for (var key in bindings) {
Expand Down
13 changes: 13 additions & 0 deletions tests/vuefire.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ describe('VueFire', function () {
})
})

describe('support Function options', function () {
it('option is callable as function', function (done) {
var spy = sinon.spy()
expect(function () {
new Vue({
firebase: spy
}).$mount()
}).to.not.throw()
expect(spy.calledOnce).to.be.true
done()
})
})

describe('bind as Array', function () {
it('throws error for invalid firebase ref', function () {
helpers.invalidFirebaseRefs.forEach(function (ref) {
Expand Down