File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
test/unit/features/global-api Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -27,4 +27,26 @@ describe('Global config', () => {
27
27
Vue . config . errorHandler = null
28
28
} )
29
29
} )
30
+
31
+ describe ( 'optionMergeStrategies' , ( ) => {
32
+ it ( 'should allow defining custom option merging strategies' , ( ) => {
33
+ const spy = jasmine . createSpy ( 'option merging' )
34
+ Vue . config . optionMergeStrategies . __test__ = ( parent , child , vm ) => {
35
+ spy ( parent , child , vm )
36
+ return child + 1
37
+ }
38
+ const Test = Vue . extend ( {
39
+ __test__ : 1
40
+ } )
41
+ expect ( spy . calls . count ( ) ) . toBe ( 1 )
42
+ expect ( spy ) . toHaveBeenCalledWith ( undefined , 1 , undefined )
43
+ expect ( Test . options . __test__ ) . toBe ( 2 )
44
+ const test = new Test ( {
45
+ __test__ : 2
46
+ } )
47
+ expect ( spy . calls . count ( ) ) . toBe ( 2 )
48
+ expect ( spy ) . toHaveBeenCalledWith ( 2 , 2 , test )
49
+ expect ( test . $options . __test__ ) . toBe ( 3 )
50
+ } )
51
+ } )
30
52
} )
You can’t perform that action at this time.
0 commit comments