@@ -10,39 +10,56 @@ var cheerio = _interopDefault(require('cheerio'));
10
10
11
11
//
12
12
13
- function startsWithTag ( str ) {
14
- return str && str . trim ( ) [ 0 ] === '<'
13
+ function createVNodes (
14
+ vm ,
15
+ slotValue
16
+ ) {
17
+ var el = vueTemplateCompiler . compileToFunctions ( ( "<div>" + slotValue + "</div>" ) ) ;
18
+ var _staticRenderFns = vm . _renderProxy . $options . staticRenderFns ;
19
+ // version < 2.5
20
+ if ( ! vm . _renderProxy . _staticTrees ) {
21
+ vm . _renderProxy . _staticTrees = [ ] ;
22
+ }
23
+ vm . _renderProxy . $options . staticRenderFns = el . staticRenderFns ;
24
+ var vnode = el . render . call ( vm . _renderProxy , vm . $createElement ) ;
25
+ vm . _renderProxy . $options . staticRenderFns = _staticRenderFns ;
26
+ return vnode . children
15
27
}
16
28
17
29
function createVNodesForSlot (
18
- h ,
30
+ vm ,
19
31
slotValue ,
20
32
name
21
33
) {
22
- if ( typeof slotValue === 'string' && ! startsWithTag ( slotValue ) ) {
23
- return slotValue
34
+ var vnode ;
35
+ if ( typeof slotValue === 'string' ) {
36
+ var vnodes = createVNodes ( vm , slotValue ) ;
37
+ vnode = vnodes [ 0 ] ;
38
+ } else {
39
+ vnode = vm . $createElement ( slotValue ) ;
40
+ }
41
+ if ( vnode . data ) {
42
+ vnode . data . slot = name ;
43
+ } else {
44
+ vnode . data = { slot : name } ;
24
45
}
25
-
26
- var el =
27
- typeof slotValue === 'string' ? vueTemplateCompiler . compileToFunctions ( slotValue ) : slotValue ;
28
-
29
- var vnode = h ( el ) ;
30
- vnode . data . slot = name ;
31
46
return vnode
32
47
}
33
48
34
49
function createSlotVNodes (
35
- h ,
50
+ vm ,
36
51
slots
37
52
) {
38
53
return Object . keys ( slots ) . reduce ( function ( acc , key ) {
39
54
var content = slots [ key ] ;
40
55
if ( Array . isArray ( content ) ) {
41
- var nodes = content . map ( function ( slotDef ) { return createVNodesForSlot ( h , slotDef , key ) ; } ) ;
56
+ var nodes = content . map (
57
+ function ( slotDef ) { return createVNodesForSlot ( vm , slotDef , key ) ; }
58
+ ) ;
42
59
return acc . concat ( nodes )
43
60
}
44
61
45
- return acc . concat ( createVNodesForSlot ( h , content , key ) )
62
+ return acc . concat ( createVNodesForSlot ( vm , content , key ) )
46
63
} , [ ] )
47
64
}
48
65
@@ -82,7 +99,10 @@ var vueVersion = Number(
82
99
83
100
//
84
101
85
- function addMocks ( mockedProperties , Vue$$1 ) {
102
+ function addMocks (
103
+ mockedProperties ,
104
+ Vue$$1
105
+ ) {
86
106
Object . keys ( mockedProperties ) . forEach ( function ( key ) {
87
107
try {
88
108
Vue$$1 . prototype [ key ] = mockedProperties [ key ] ;
@@ -127,6 +147,26 @@ function addEventLogger (vue) {
127
147
128
148
//
129
149
150
+ function isVueComponent ( component ) {
151
+ if ( typeof component === 'function' && component . options ) {
152
+ return true
153
+ }
154
+
155
+ if ( component === null || typeof component !== 'object' ) {
156
+ return false
157
+ }
158
+
159
+ if ( component . extends || component . _Ctor ) {
160
+ return true
161
+ }
162
+
163
+ if ( typeof component . template === 'string' ) {
164
+ return true
165
+ }
166
+
167
+ return typeof component . render === 'function'
168
+ }
169
+
130
170
function componentNeedsCompiling ( component ) {
131
171
return (
132
172
component &&
@@ -136,13 +176,20 @@ function componentNeedsCompiling (component) {
136
176
)
137
177
}
138
178
139
- function templateContainsComponent ( template , name ) {
179
+ function templateContainsComponent (
180
+ template ,
181
+ name
182
+ ) {
140
183
return [ capitalize , camelize , hyphenate ] . some ( function ( format ) {
141
184
var re = new RegExp ( ( "<" + ( format ( name ) ) + "\\s*(\\s|>|(/>))" ) , 'g' ) ;
142
185
return re . test ( template )
143
186
} )
144
187
}
145
188
189
+ function isPlainObject ( obj ) {
190
+ return Object . prototype . toString . call ( obj ) === '[object Object]'
191
+ }
192
+
146
193
//
147
194
148
195
function compileTemplate ( component ) {
@@ -170,36 +217,46 @@ function compileTemplate (component) {
170
217
171
218
//
172
219
173
- function isVueComponent$1 ( comp ) {
174
- return comp && ( comp . render || comp . template || comp . options )
220
+ function isVueComponentStub ( comp ) {
221
+ return comp && comp . template || isVueComponent ( comp )
175
222
}
176
223
177
224
function isValidStub ( stub ) {
178
225
return (
179
226
( ! ! stub && typeof stub === 'string' ) ||
180
227
stub === true ||
181
- isVueComponent$1 ( stub )
228
+ isVueComponentStub ( stub )
182
229
)
183
230
}
184
231
185
- function getCoreProperties ( component ) {
232
+ function resolveComponent ( obj , component ) {
233
+ return obj [ component ] ||
234
+ obj [ hyphenate ( component ) ] ||
235
+ obj [ camelize ( component ) ] ||
236
+ obj [ capitalize ( camelize ( component ) ) ] ||
237
+ obj [ capitalize ( component ) ] ||
238
+ { }
239
+ }
240
+
241
+ function getCoreProperties ( componentOptions ) {
186
242
return {
187
- attrs : component . attrs ,
188
- name : component . name ,
189
- on : component . on ,
190
- key : component . key ,
191
- ref : component . ref ,
192
- props : component . props ,
193
- domProps : component . domProps ,
194
- class : component . class ,
195
- staticClass : component . staticClass ,
196
- staticStyle : component . staticStyle ,
197
- style : component . style ,
198
- normalizedStyle : component . normalizedStyle ,
199
- nativeOn : component . nativeOn ,
200
- functional : component . functional
243
+ attrs : componentOptions . attrs ,
244
+ name : componentOptions . name ,
245
+ on : componentOptions . on ,
246
+ key : componentOptions . key ,
247
+ ref : componentOptions . ref ,
248
+ props : componentOptions . props ,
249
+ domProps : componentOptions . domProps ,
250
+ class : componentOptions . class ,
251
+ staticClass : componentOptions . staticClass ,
252
+ staticStyle : componentOptions . staticStyle ,
253
+ style : componentOptions . style ,
254
+ normalizedStyle : componentOptions . normalizedStyle ,
255
+ nativeOn : componentOptions . nativeOn ,
256
+ functional : componentOptions . functional
201
257
}
202
258
}
259
+
203
260
function createStubFromString (
204
261
templateString ,
205
262
originalComponent ,
@@ -217,21 +274,34 @@ function createStubFromString (
217
274
throwError ( 'options.stub cannot contain a circular reference' ) ;
218
275
}
219
276
220
- return Object . assign ( { } , getCoreProperties ( originalComponent ) ,
277
+ var componentOptions = typeof originalComponent === 'function'
278
+ ? originalComponent . extendOptions
279
+ : originalComponent ;
280
+
281
+ return Object . assign ( { } , getCoreProperties ( componentOptions ) ,
221
282
vueTemplateCompiler . compileToFunctions ( templateString ) )
222
283
}
223
284
224
- function createBlankStub ( originalComponent ) {
225
- var name = ( originalComponent . name ) + "-stub" ;
285
+ function createBlankStub (
286
+ originalComponent ,
287
+ name
288
+ ) {
289
+ var componentOptions = typeof originalComponent === 'function'
290
+ ? originalComponent . extendOptions
291
+ : originalComponent ;
292
+ var tagName = name + "-stub" ;
226
293
227
294
// ignoreElements does not exist in Vue 2.0.x
228
295
if ( Vue . config . ignoredElements ) {
229
- Vue . config . ignoredElements . push ( name ) ;
296
+ Vue . config . ignoredElements . push ( tagName ) ;
230
297
}
231
298
232
- return Object . assign ( { } , getCoreProperties ( originalComponent ) ,
299
+ return Object . assign ( { } , getCoreProperties ( componentOptions ) ,
233
300
{ render : function render ( h ) {
234
- return h ( name )
301
+ return h (
302
+ tagName ,
303
+ ! componentOptions . functional && this . $slots . default
304
+ )
235
305
} } )
236
306
}
237
307
@@ -254,78 +324,98 @@ function createComponentStubs (
254
324
if ( typeof stub !== 'string' ) {
255
325
throwError ( "each item in an options.stubs array must be a " + "string" ) ;
256
326
}
257
- components [ stub ] = createBlankStub ( { name : stub } ) ;
327
+ var component = resolveComponent ( originalComponents , stub ) ;
328
+
329
+ components [ stub ] = createBlankStub ( component , stub ) ;
258
330
} ) ;
259
331
} else {
260
- Object . keys ( stubs ) . forEach ( function ( stub ) {
261
- if ( stubs [ stub ] === false ) {
332
+ var stubsObject = ( stubs ) ;
333
+ Object . keys ( stubsObject ) . forEach ( function ( stubName ) {
334
+ var stub = stubsObject [ stubName ] ;
335
+ if ( stub === false ) {
262
336
return
263
337
}
264
- if ( ! isValidStub ( stubs [ stub ] ) ) {
338
+
339
+ if ( ! isValidStub ( stub ) ) {
265
340
throwError (
266
341
"options.stub values must be passed a string or " + "component"
267
342
) ;
268
343
}
269
- if ( stubs [ stub ] === true ) {
270
- components [ stub ] = createBlankStub ( { name : stub } ) ;
344
+
345
+ if ( stub === true ) {
346
+ var component = resolveComponent ( originalComponents , stubName ) ;
347
+ components [ stubName ] = createBlankStub ( component , stubName ) ;
271
348
return
272
349
}
273
350
274
- if ( componentNeedsCompiling ( stubs [ stub ] ) ) {
275
- compileTemplate ( stubs [ stub ] ) ;
351
+ if ( typeof stub !== 'string' && componentNeedsCompiling ( stub ) ) {
352
+ compileTemplate ( stub ) ;
276
353
}
277
354
278
- if ( originalComponents [ stub ] ) {
355
+ if ( originalComponents [ stubName ] ) {
279
356
// Remove cached constructor
280
- delete originalComponents [ stub ] . _Ctor ;
281
- if ( typeof stubs [ stub ] === 'string' ) {
282
- components [ stub ] = createStubFromString (
283
- stubs [ stub ] ,
284
- originalComponents [ stub ] ,
285
- stub
357
+ delete originalComponents [ stubName ] . _Ctor ;
358
+ if ( typeof stub === 'string' ) {
359
+ components [ stubName ] = createStubFromString (
360
+ stub ,
361
+ originalComponents [ stubName ] ,
362
+ stubName
286
363
) ;
287
364
} else {
288
- components [ stub ] = Object . assign ( { } , stubs [ stub ] ,
289
- { name : originalComponents [ stub ] . name } ) ;
365
+ var stubObject = ( stub ) ;
366
+ components [ stubName ] = Object . assign ( { } , stubObject ,
367
+ { name : originalComponents [ stubName ] . name } ) ;
290
368
}
291
369
} else {
292
- if ( typeof stubs [ stub ] === 'string' ) {
370
+ if ( typeof stub === 'string' ) {
293
371
if ( ! vueTemplateCompiler . compileToFunctions ) {
294
372
throwError (
295
373
"vueTemplateCompiler is undefined, you must pass " +
296
374
"precompiled components if vue-template-compiler is " +
297
375
"undefined"
298
376
) ;
299
377
}
300
- components [ stub ] = Object . assign ( { } , vueTemplateCompiler . compileToFunctions ( stubs [ stub ] ) ) ;
378
+ components [ stubName ] = Object . assign ( { } , vueTemplateCompiler . compileToFunctions ( stub ) ) ;
301
379
} else {
302
- components [ stub ] = Object . assign ( { } , stubs [ stub ] ) ;
380
+ var stubObject$1 = ( stub ) ;
381
+ components [ stubName ] = Object . assign ( { } , stubObject$1 ) ;
303
382
}
304
383
}
305
384
} ) ;
306
385
}
307
386
return components
308
387
}
309
388
310
- function deleteMountingOptions ( options ) {
311
- delete options . attachToDocument ;
312
- delete options . mocks ;
313
- delete options . slots ;
314
- delete options . localVue ;
315
- delete options . stubs ;
316
- delete options . context ;
317
- delete options . clone ;
318
- delete options . attrs ;
319
- delete options . listeners ;
320
- delete options . propsData ;
389
+ //
390
+
391
+ var MOUNTING_OPTIONS = [
392
+ 'attachToDocument' ,
393
+ 'mocks' ,
394
+ 'slots' ,
395
+ 'localVue' ,
396
+ 'stubs' ,
397
+ 'context' ,
398
+ 'clone' ,
399
+ 'attrs' ,
400
+ 'listeners' ,
401
+ 'propsData'
402
+ ] ;
403
+
404
+ function extractInstanceOptions (
405
+ options
406
+ ) {
407
+ var instanceOptions = Object . assign ( { } , options ) ;
408
+ MOUNTING_OPTIONS . forEach ( function ( mountingOption ) {
409
+ delete instanceOptions [ mountingOption ] ;
410
+ } ) ;
411
+ return instanceOptions
321
412
}
322
413
323
414
//
324
415
325
416
function isValidSlot ( slot ) {
326
417
return (
327
- Array . isArray ( slot ) ||
328
- ( slot !== null && typeof slot === 'object' ) ||
418
+ isVueComponent ( slot ) ||
329
419
typeof slot === 'string'
330
420
)
331
421
}
@@ -342,25 +432,17 @@ function requiresTemplateCompiler (slot) {
342
432
343
433
function validateSlots ( slots ) {
344
434
Object . keys ( slots ) . forEach ( function ( key ) {
345
- if ( ! isValidSlot ( slots [ key ] ) ) {
346
- throwError (
347
- "slots[key] must be a Component, string or an array " + "of Components"
348
- ) ;
349
- }
350
-
351
- requiresTemplateCompiler ( slots [ key ] ) ;
435
+ var slot = Array . isArray ( slots [ key ] ) ? slots [ key ] : [ slots [ key ] ] ;
352
436
353
- if ( Array . isArray ( slots [ key ] ) ) {
354
- slots [ key ] . forEach ( function ( slotValue ) {
355
- if ( ! isValidSlot ( slotValue ) ) {
356
- throwError (
357
- "slots[key] must be a Component, string or an array " +
358
- "of Components"
359
- ) ;
360
- }
361
- requiresTemplateCompiler ( slotValue ) ;
362
- } ) ;
363
- }
437
+ slot . forEach ( function ( slotValue ) {
438
+ if ( ! isValidSlot ( slotValue ) ) {
439
+ throwError (
440
+ "slots[key] must be a Component, string or an array " +
441
+ "of Components"
442
+ ) ;
443
+ }
444
+ requiresTemplateCompiler ( slotValue ) ;
445
+ } ) ;
364
446
} ) ;
365
447
}
366
448
@@ -387,7 +469,7 @@ function createFunctionalComponent (
387
469
mountingOptions . context . children . map (
388
470
function ( x ) { return ( typeof x === 'function' ? x ( h ) : x ) ; }
389
471
) ) ||
390
- createSlotVNodes ( h , mountingOptions . slots || { } )
472
+ createSlotVNodes ( this , mountingOptions . slots || { } )
391
473
)
392
474
} ,
393
475
name : component . name ,
@@ -397,6 +479,105 @@ function createFunctionalComponent (
397
479
398
480
//
399
481
482
+ function isDestructuringSlotScope ( slotScope ) {
483
+ return slotScope [ 0 ] === '{' && slotScope [ slotScope . length - 1 ] === '}'
484
+ }
485
+
486
+ function getVueTemplateCompilerHelpers ( ) {
487
+ var vue = new Vue ( ) ;
488
+ var helpers = { } ;
489
+ var names = [
490
+ '_c' ,
491
+ '_o' ,
492
+ '_n' ,
493
+ '_s' ,
494
+ '_l' ,
495
+ '_t' ,
496
+ '_q' ,
497
+ '_i' ,
498
+ '_m' ,
499
+ '_f' ,
500
+ '_k' ,
501
+ '_b' ,
502
+ '_v' ,
503
+ '_e' ,
504
+ '_u' ,
505
+ '_g'
506
+ ] ;
507
+ names . forEach ( function ( name ) {
508
+ helpers [ name ] = vue . _renderProxy [ name ] ;
509
+ } ) ;
510
+ return helpers
511
+ }
512
+
513
+ function validateEnvironment ( ) {
514
+ if ( window . navigator . userAgent . match ( / P h a n t o m J S / i) ) {
515
+ throwError (
516
+ "the scopedSlots option does not support PhantomJS. " +
517
+ "Please use Puppeteer, or pass a component."
518
+ ) ;
519
+ }
520
+ if ( vueVersion < 2.5 ) {
521
+ throwError ( "the scopedSlots option is only supported in " + "vue@2.5+." ) ;
522
+ }
523
+ }
524
+
525
+ function validateTempldate ( template ) {
526
+ if ( template . trim ( ) . substr ( 0 , 9 ) === '<template' ) {
527
+ throwError (
528
+ "the scopedSlots option does not support a template " +
529
+ "tag as the root element."
530
+ ) ;
531
+ }
532
+ }
533
+
534
+ function createScopedSlots (
535
+ scopedSlotsOption
536
+ ) {
537
+ var scopedSlots = { } ;
538
+ if ( ! scopedSlotsOption ) {
539
+ return scopedSlots
540
+ }
541
+ validateEnvironment ( ) ;
542
+ var helpers = getVueTemplateCompilerHelpers ( ) ;
543
+ var loop = function ( name ) {
544
+ var template = scopedSlotsOption [ name ] ;
545
+ validateTempldate ( template ) ;
546
+ var render = vueTemplateCompiler . compileToFunctions ( template ) . render ;
547
+ var domParser = new window . DOMParser ( ) ;
548
+ var _document = domParser . parseFromString ( template , 'text/html' ) ;
549
+ var slotScope = _document . body . firstChild . getAttribute (
550
+ 'slot-scope'
551
+ ) ;
552
+ var isDestructuring = isDestructuringSlotScope ( slotScope ) ;
553
+ scopedSlots [ name ] = function ( props ) {
554
+ var obj ;
555
+
556
+ if ( isDestructuring ) {
557
+ return render . call ( Object . assign ( { } , helpers , props ) )
558
+ } else {
559
+ return render . call ( Object . assign ( { } , helpers , ( obj = { } , obj [ slotScope ] = props , obj ) ) )
560
+ }
561
+ } ;
562
+ } ;
563
+
564
+ for ( var name in scopedSlotsOption ) loop ( name ) ;
565
+ return scopedSlots
566
+ }
567
+
568
+ //
569
+
570
+ function compileTemplateForSlots ( slots ) {
571
+ Object . keys ( slots ) . forEach ( function ( key ) {
572
+ var slot = Array . isArray ( slots [ key ] ) ? slots [ key ] : [ slots [ key ] ] ;
573
+ slot . forEach ( function ( slotValue ) {
574
+ if ( componentNeedsCompiling ( slotValue ) ) {
575
+ compileTemplate ( slotValue ) ;
576
+ }
577
+ } ) ;
578
+ } ) ;
579
+ }
580
+
400
581
function createInstance (
401
582
component ,
402
583
options ,
@@ -406,6 +587,18 @@ function createInstance (
406
587
// Remove cached constructor
407
588
delete component . _Ctor ;
408
589
590
+ // mounting options are vue-test-utils specific
591
+ //
592
+ // instance options are options that are passed to the
593
+ // root instance when it's instantiated
594
+ //
595
+ // component options are the root components options
596
+ var componentOptions = typeof component === 'function'
597
+ ? component . extendOptions
598
+ : component ;
599
+
600
+ var instanceOptions = extractInstanceOptions ( options ) ;
601
+
409
602
if ( options . mocks ) {
410
603
addMocks ( options . mocks , _Vue ) ;
411
604
}
@@ -426,10 +619,6 @@ function createInstance (
426
619
427
620
addEventLogger ( _Vue ) ;
428
621
429
- var instanceOptions = Object . assign ( { } , options ) ;
430
-
431
- deleteMountingOptions ( instanceOptions ) ;
432
-
433
622
var stubComponents = createComponentStubs (
434
623
// $FlowIgnore
435
624
component . components ,
@@ -449,9 +638,9 @@ function createInstance (
449
638
) ;
450
639
}
451
640
} ) ;
452
- Object . keys ( component . components || { } ) . forEach ( function ( c ) {
641
+ Object . keys ( componentOptions . components || { } ) . forEach ( function ( c ) {
453
642
if (
454
- component . components [ c ] . extendOptions &&
643
+ componentOptions . components [ c ] . extendOptions &&
455
644
! instanceOptions . components [ c ]
456
645
) {
457
646
if ( options . logModifiedComponents ) {
@@ -464,7 +653,9 @@ function createInstance (
464
653
"option."
465
654
) ;
466
655
}
467
- instanceOptions . components [ c ] = _Vue . extend ( component . components [ c ] ) ;
656
+ instanceOptions . components [ c ] = _Vue . extend (
657
+ componentOptions . components [ c ]
658
+ ) ;
468
659
}
469
660
} ) ;
470
661
@@ -482,6 +673,8 @@ function createInstance (
482
673
} ) ;
483
674
484
675
if ( options . slots ) {
676
+ compileTemplateForSlots ( options . slots ) ;
677
+ // $FlowIgnore
485
678
validateSlots ( options . slots ) ;
486
679
}
487
680
@@ -496,52 +689,66 @@ function createInstance (
496
689
options . provide = function ( ) { return obj ; } ;
497
690
}
498
691
499
- var Parent = _Vue . extend ( {
500
- provide : options . provide ,
501
- render : function render ( h ) {
502
- var slots = options . slots
503
- ? createSlotVNodes ( h , options . slots )
504
- : undefined ;
505
- return h (
506
- Constructor ,
507
- {
508
- ref : 'vm' ,
509
- props : options . propsData ,
510
- on : options . listeners ,
511
- attrs : options . attrs
512
- } ,
513
- slots
514
- )
515
- }
516
- } ) ;
692
+ var scopedSlots = createScopedSlots ( options . scopedSlots ) ;
693
+
694
+ if ( options . parentComponent && ! isPlainObject ( options . parentComponent ) ) {
695
+ throwError (
696
+ "options.parentComponent should be a valid Vue component " +
697
+ "options object"
698
+ ) ;
699
+ }
700
+
701
+ var parentComponentOptions = options . parentComponent || { } ;
702
+ parentComponentOptions . provide = options . provide ;
703
+ parentComponentOptions . render = function ( h ) {
704
+ var slots = options . slots
705
+ ? createSlotVNodes ( this , options . slots )
706
+ : undefined ;
707
+ return h (
708
+ Constructor ,
709
+ {
710
+ ref : 'vm' ,
711
+ props : options . propsData ,
712
+ on : options . listeners ,
713
+ attrs : options . attrs ,
714
+ scopedSlots : scopedSlots
715
+ } ,
716
+ slots
717
+ )
718
+ } ;
719
+ var Parent = _Vue . extend ( parentComponentOptions ) ;
517
720
518
721
return new Parent ( )
519
722
}
520
723
521
724
//
522
725
523
- function getOptions ( key , options , config ) {
524
- if ( options || ( config [ key ] && Object . keys ( config [ key ] ) . length > 0 ) ) {
525
- if ( options instanceof Function ) {
526
- return options
527
- } else if ( Array . isArray ( options ) ) {
528
- return options . concat ( Object . keys ( config [ key ] || { } ) )
529
- } else if ( ! ( config [ key ] instanceof Function ) ) {
530
- return Object . assign ( { } , config [ key ] ,
531
- options )
532
- } else {
726
+ function getOption ( option , config ) {
727
+ if ( option || ( config && Object . keys ( config ) . length > 0 ) ) {
728
+ if ( option instanceof Function ) {
729
+ return option
730
+ } else if ( Array . isArray ( option ) ) {
731
+ return option . concat ( Object . keys ( config || { } ) )
732
+ } else if ( config instanceof Function ) {
533
733
throw new Error ( "Config can't be a Function." )
734
+ } else {
735
+ return Object . assign ( { } , config ,
736
+ option )
534
737
}
535
738
}
536
739
}
537
740
538
741
function mergeOptions ( options , config ) {
742
+ var mocks = ( getOption ( options . mocks , config . mocks ) ) ;
743
+ var methods = (
744
+ ( getOption ( options . methods , config . methods ) ) ) ;
745
+ var provide = ( ( getOption ( options . provide , config . provide ) ) ) ;
539
746
return Object . assign ( { } , options ,
540
747
{ logModifiedComponents : config . logModifiedComponents ,
541
- stubs : getOptions ( 'stubs' , options . stubs , config ) ,
542
- mocks : getOptions ( ' mocks' , options . mocks , config ) ,
543
- methods : getOptions ( ' methods' , options . methods , config ) ,
544
- provide : getOptions ( ' provide' , options . provide , config ) ,
748
+ stubs : getOption ( options . stubs , config . stubs ) ,
749
+ mocks : mocks ,
750
+ methods : methods ,
751
+ provide : provide ,
545
752
sync : ! ! ( options . sync || options . sync === undefined ) } )
546
753
}
547
754
0 commit comments