File tree 2 files changed +18
-22
lines changed
test/unit/features/options
2 files changed +18
-22
lines changed Original file line number Diff line number Diff line change @@ -395,7 +395,7 @@ export function mergeOptions (
395
395
}
396
396
397
397
if ( typeof child === 'function' ) {
398
- child = child . options
398
+ child = child . extendOptions
399
399
}
400
400
401
401
normalizeProps ( child , vm )
Original file line number Diff line number Diff line change @@ -110,35 +110,31 @@ describe('Options mixins', () => {
110
110
expect ( vm . $options . directives . c ) . toBeDefined ( )
111
111
} )
112
112
113
- it ( 'should accept further extended constructors as mixins' , ( ) => {
114
- const spy1 = jasmine . createSpy ( 'mixinA' )
115
- const spy2 = jasmine . createSpy ( 'mixinB' )
113
+ it ( 'should not mix global mixined lifecycle hook twice' , ( ) => {
114
+ const spy = jasmine . createSpy ( 'global mixed in lifecycle hook' )
115
+ Vue . mixin ( {
116
+ created ( ) {
117
+ spy ( )
118
+ }
119
+ } )
116
120
117
- const mixinA = Vue . extend ( {
118
- created : spy1 ,
119
- directives : {
120
- c : { }
121
- } ,
121
+ const mixin1 = Vue . extend ( {
122
122
methods : {
123
- a : function ( ) { }
123
+ a ( ) { }
124
124
}
125
125
} )
126
126
127
- const mixinB = mixinA . extend ( {
128
- created : spy2
127
+ const mixin2 = Vue . extend ( {
128
+ mixins : [ mixin1 ] ,
129
129
} )
130
130
131
- const vm = new Vue ( {
132
- mixins : [ mixinB ] ,
133
- methods : {
134
- b : function ( ) { }
135
- }
131
+ const Child = Vue . extend ( {
132
+ mixins : [ mixin2 ] ,
136
133
} )
137
134
138
- expect ( spy1 ) . toHaveBeenCalledTimes ( 1 )
139
- expect ( spy2 ) . toHaveBeenCalledTimes ( 1 )
140
- expect ( vm . a ) . toBeDefined ( )
141
- expect ( vm . b ) . toBeDefined ( )
142
- expect ( vm . $options . directives . c ) . toBeDefined ( )
135
+ const vm = new Child ( )
136
+
137
+ expect ( typeof vm . $options . methods . a ) . toBe ( 'function' )
138
+ expect ( spy . calls . count ( ) ) . toBe ( 1 )
143
139
} )
144
140
} )
You can’t perform that action at this time.
0 commit comments