diff --git a/src/vuefire.js b/src/vuefire.js index 03d183af..60552c83 100644 --- a/src/vuefire.js +++ b/src/vuefire.js @@ -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) { diff --git a/tests/vuefire.spec.js b/tests/vuefire.spec.js index f5877fe5..ae5599f5 100644 --- a/tests/vuefire.spec.js +++ b/tests/vuefire.spec.js @@ -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) {