mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-03 12:38:24 +08:00
test for config.optionMergeStrategies
This commit is contained in:
parent
34bcc02b77
commit
cccfda96da
@ -27,4 +27,26 @@ describe('Global config', () => {
|
||||
Vue.config.errorHandler = null
|
||||
})
|
||||
})
|
||||
|
||||
describe('optionMergeStrategies', () => {
|
||||
it('should allow defining custom option merging strategies', () => {
|
||||
const spy = jasmine.createSpy('option merging')
|
||||
Vue.config.optionMergeStrategies.__test__ = (parent, child, vm) => {
|
||||
spy(parent, child, vm)
|
||||
return child + 1
|
||||
}
|
||||
const Test = Vue.extend({
|
||||
__test__: 1
|
||||
})
|
||||
expect(spy.calls.count()).toBe(1)
|
||||
expect(spy).toHaveBeenCalledWith(undefined, 1, undefined)
|
||||
expect(Test.options.__test__).toBe(2)
|
||||
const test = new Test({
|
||||
__test__: 2
|
||||
})
|
||||
expect(spy.calls.count()).toBe(2)
|
||||
expect(spy).toHaveBeenCalledWith(2, 2, test)
|
||||
expect(test.$options.__test__).toBe(3)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user