Skip to content

Commit 720c24c

Browse files
committed
Set mergeStrats to data
Allow merging firebase options when defined as functions
1 parent dc8a416 commit 720c24c

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/vuefire.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ function install (_Vue) {
250250
Vue = _Vue
251251
Vue.mixin(VueFireMixin)
252252

253-
// use object-based merge strategy
253+
// use data-like merge strategy
254254
var mergeStrats = Vue.config.optionMergeStrategies
255-
mergeStrats.firebase = mergeStrats.methods
255+
mergeStrats.firebase = mergeStrats.data
256256

257257
// extend instance methods
258258
Vue.prototype.$bindAsObject = function (key, source, cancelCallback, readyCallback) {

tests/vuefire.spec.js

+26
Original file line numberDiff line numberDiff line change
@@ -1012,4 +1012,30 @@ describe('VueFire', function () {
10121012
})
10131013
})
10141014
})
1015+
1016+
describe('mixins', function () {
1017+
var mixinFn
1018+
beforeEach(function () {
1019+
mixinFn = {
1020+
firebase: function () {
1021+
return {
1022+
items: firebaseRef.child('items')
1023+
}
1024+
}
1025+
}
1026+
})
1027+
1028+
it('func/func', function () {
1029+
var vm = new Vue({
1030+
firebase: function () {
1031+
return {
1032+
item: firebaseRef.child('first')
1033+
}
1034+
},
1035+
mixins: [mixinFn]
1036+
}).$mount()
1037+
expect(vm.items).to.not.be.undefined
1038+
expect(vm.item).to.not.be.undefined
1039+
})
1040+
})
10151041
})

0 commit comments

Comments
 (0)