Skip to content

Commit 001ff40

Browse files
committed
feat(firestore option merging):
1 parent b5342a6 commit 001ff40

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ function bind ({ vm, key, ref }) {
8282
}
8383

8484
function install (Vue, options) {
85+
const strategies = Vue.config.optionMergeStrategies
86+
strategies.firestore = strategies.methods
87+
8588
Vue.mixin({
8689
created () {
8790
const { firestore } = this.$options

test/merging.spec.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import test from 'ava'
2+
import Vuefire from '../src'
3+
import {
4+
db,
5+
tick,
6+
Vue
7+
} from './helpers'
8+
9+
Vue.use(Vuefire)
10+
11+
test.beforeEach(async t => {
12+
t.context.mWithObjA = {
13+
firestore: {
14+
a: db.collection(1),
15+
b: db.collection(2)
16+
}
17+
}
18+
19+
t.context.mWithObjB = {
20+
firestore: {
21+
a: db.collection(3),
22+
c: db.collection(4)
23+
}
24+
}
25+
})
26+
27+
test('should merge properties', t => {
28+
const { mWithObjA, mWithObjB } = t.context
29+
const vm = new Vue({
30+
mixins: [mWithObjA, mWithObjB],
31+
render: h => h('p', 'foo')
32+
})
33+
t.deepEqual(vm.$firestoreRefs, {
34+
a: db.collection(3),
35+
b: db.collection(2),
36+
c: db.collection(4)
37+
})
38+
})

0 commit comments

Comments
 (0)