File tree 2 files changed +30
-2
lines changed
test/unit/features/options
2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -376,13 +376,13 @@ export function mergeOptions (
376
376
}
377
377
378
378
if ( typeof child === 'function' ) {
379
- child = child . options
379
+ child = child . extendOptions
380
380
}
381
381
382
382
normalizeProps ( child , vm )
383
383
normalizeInject ( child , vm )
384
384
normalizeDirectives ( child )
385
-
385
+
386
386
// Apply extends and mixins on the child options,
387
387
// but only if it is a raw options object that isn't
388
388
// the result of another mergeOptions call.
Original file line number Diff line number Diff line change @@ -109,4 +109,32 @@ describe('Options mixins', () => {
109
109
expect ( vm . b ) . toBeDefined ( )
110
110
expect ( vm . $options . directives . c ) . toBeDefined ( )
111
111
} )
112
+
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
+ } )
120
+
121
+ const mixin1 = Vue . extend ( {
122
+ methods : {
123
+ a ( ) { }
124
+ }
125
+ } )
126
+
127
+ const mixin2 = Vue . extend ( {
128
+ mixins : [ mixin1 ] ,
129
+ } )
130
+
131
+ const Child = Vue . extend ( {
132
+ mixins : [ mixin2 ] ,
133
+ } )
134
+
135
+ const vm = new Child ( )
136
+
137
+ expect ( typeof vm . $options . methods . a ) . toBe ( 'function' )
138
+ expect ( spy . calls . count ( ) ) . toBe ( 1 )
139
+ } )
112
140
} )
You can’t perform that action at this time.
0 commit comments