@@ -1750,7 +1750,7 @@ function isVueComponent(c) {
1750
1750
return true
1751
1751
}
1752
1752
1753
- if ( c === null || typeof c !== 'object' ) {
1753
+ if ( ! isPlainObject ( c ) ) {
1754
1754
return false
1755
1755
}
1756
1756
@@ -1780,8 +1780,8 @@ function componentNeedsCompiling(component) {
1780
1780
1781
1781
function isRefSelector ( refOptionsObject ) {
1782
1782
if (
1783
- typeof refOptionsObject !== 'object' ||
1784
- Object . keys ( refOptionsObject || { } ) . length !== 1
1783
+ ! isPlainObject ( refOptionsObject ) ||
1784
+ keys$1 ( refOptionsObject || { } ) . length !== 1
1785
1785
) {
1786
1786
return false
1787
1787
}
@@ -1790,7 +1790,7 @@ function isRefSelector(refOptionsObject) {
1790
1790
}
1791
1791
1792
1792
function isNameSelector ( nameOptionsObject ) {
1793
- if ( typeof nameOptionsObject !== 'object' || nameOptionsObject === null ) {
1793
+ if ( ! isPlainObject ( nameOptionsObject ) ) {
1794
1794
return false
1795
1795
}
1796
1796
@@ -1806,7 +1806,7 @@ function isDynamicComponent(c) {
1806
1806
}
1807
1807
1808
1808
function isComponentOptions ( c ) {
1809
- return c !== null && typeof c === 'object' && ( c . template || c . render )
1809
+ return isPlainObject ( c ) && ( c . template || c . render )
1810
1810
}
1811
1811
1812
1812
function isFunctionalComponent ( c ) {
@@ -1848,10 +1848,10 @@ function makeMap(str, expectsLowerCase) {
1848
1848
map [ list [ i ] ] = true ;
1849
1849
}
1850
1850
return expectsLowerCase
1851
- ? function ( val ) {
1851
+ ? function ( val ) {
1852
1852
return map [ val . toLowerCase ( ) ]
1853
1853
}
1854
- : function ( val ) {
1854
+ : function ( val ) {
1855
1855
return map [ val ]
1856
1856
}
1857
1857
}
@@ -1923,7 +1923,7 @@ function vmCtorMatches(vm, component) {
1923
1923
}
1924
1924
1925
1925
if ( component . functional ) {
1926
- return Object . keys ( vm . _Ctor || { } ) . some ( function ( c ) {
1926
+ return keys$1 ( vm . _Ctor || { } ) . some ( function ( c ) {
1927
1927
return component === vm . _Ctor [ c ] . extendOptions
1928
1928
} )
1929
1929
}
@@ -2105,7 +2105,7 @@ function getOption(option, config) {
2105
2105
if ( option === false ) {
2106
2106
return false
2107
2107
}
2108
- if ( option || ( config && Object . keys ( config ) . length > 0 ) ) {
2108
+ if ( option || ( config && keys$1 ( config ) . length > 0 ) ) {
2109
2109
if ( option instanceof Function ) {
2110
2110
return option
2111
2111
}
@@ -2129,7 +2129,7 @@ function mergeOptions(
2129
2129
) {
2130
2130
var mocks = ( getOption ( options . mocks , config . mocks ) ) ;
2131
2131
var methods = ( getOption ( options . methods , config . methods ) ) ;
2132
- if ( methods && Object . keys ( methods ) . length ) {
2132
+ if ( methods && keys$1 ( methods ) . length ) {
2133
2133
warnDeprecated (
2134
2134
'overwriting methods via the `methods` property' ,
2135
2135
'There is no clear migration path for the `methods` property - Vue does not support arbitrarily replacement of methods, nor should VTU. To stub a complex method extract it from the component and test it in isolation. Otherwise, the suggestion is to rethink those tests'
@@ -8084,7 +8084,10 @@ ErrorWrapper.prototype.destroy = function destroy () {
8084
8084
*/
8085
8085
8086
8086
function isStyleVisible ( element ) {
8087
- if ( ! ( element instanceof HTMLElement ) && ! ( element instanceof SVGElement ) ) {
8087
+ if (
8088
+ ! ( element instanceof window . HTMLElement ) &&
8089
+ ! ( element instanceof window . SVGElement )
8090
+ ) {
8088
8091
return false
8089
8092
}
8090
8093
@@ -8124,14 +8127,14 @@ function isElementVisible(element, previousElement) {
8124
8127
}
8125
8128
8126
8129
function recursivelySetData ( vm , target , data ) {
8127
- Object . keys ( data ) . forEach ( function ( key ) {
8130
+ keys$1 ( data ) . forEach ( function ( key ) {
8128
8131
var val = data [ key ] ;
8129
8132
var targetVal = target [ key ] ;
8130
8133
8131
8134
if (
8132
8135
isPlainObject ( val ) &&
8133
8136
isPlainObject ( targetVal ) &&
8134
- Object . keys ( val ) . length > 0
8137
+ keys$1 ( val ) . length > 0
8135
8138
) {
8136
8139
recursivelySetData ( vm , targetVal , val ) ;
8137
8140
} else {
@@ -9379,10 +9382,10 @@ var w3cKeys = {
9379
9382
esc : 'Esc' ,
9380
9383
escape : 'Escape' ,
9381
9384
space : ' ' ,
9382
- up : 'Up ' ,
9383
- left : 'Left ' ,
9384
- right : 'Right ' ,
9385
- down : 'Down ' ,
9385
+ up : 'ArrowUp ' ,
9386
+ left : 'ArrowLeft ' ,
9387
+ right : 'ArrowRight ' ,
9388
+ down : 'ArrowDown ' ,
9386
9389
end : 'End' ,
9387
9390
home : 'Home' ,
9388
9391
backspace : 'Backspace' ,
@@ -9467,7 +9470,7 @@ function createDOMEvent(type, options) {
9467
9470
: createOldEvent ( eventParams ) ;
9468
9471
9469
9472
var eventPrototype = Object . getPrototypeOf ( event ) ;
9470
- Object . keys ( options || { } ) . forEach ( function ( key ) {
9473
+ keys$1 ( options || { } ) . forEach ( function ( key ) {
9471
9474
var propertyDescriptor = Object . getOwnPropertyDescriptor (
9472
9475
eventPrototype ,
9473
9476
key
@@ -9573,17 +9576,14 @@ Wrapper.prototype.classes = function classes (className) {
9573
9576
var classes = classAttribute ? classAttribute . split ( ' ' ) : [ ] ;
9574
9577
// Handle converting cssmodules identifiers back to the original class name
9575
9578
if ( this . vm && this . vm . $style ) {
9576
- var cssModuleIdentifiers = Object . keys ( this . vm . $style ) . reduce (
9577
- function ( acc , key ) {
9578
- // $FlowIgnore
9579
- var moduleIdent = this$1 . vm . $style [ key ] ;
9580
- if ( moduleIdent ) {
9581
- acc [ moduleIdent . split ( ' ' ) [ 0 ] ] = key ;
9582
- }
9583
- return acc
9584
- } ,
9585
- { }
9586
- ) ;
9579
+ var cssModuleIdentifiers = keys$1 ( this . vm . $style ) . reduce ( function ( acc , key ) {
9580
+ // $FlowIgnore
9581
+ var moduleIdent = this$1 . vm . $style [ key ] ;
9582
+ if ( moduleIdent ) {
9583
+ acc [ moduleIdent . split ( ' ' ) [ 0 ] ] = key ;
9584
+ }
9585
+ return acc
9586
+ } , { } ) ;
9587
9587
classes = classes . map ( function ( name ) { return cssModuleIdentifiers [ name ] || name ; } ) ;
9588
9588
}
9589
9589
@@ -9937,7 +9937,7 @@ Wrapper.prototype.overview = function overview () {
9937
9937
var computed = this . vm . _computedWatchers
9938
9938
? formatJSON . apply (
9939
9939
// $FlowIgnore
9940
- void 0 , Object . keys ( this . vm . _computedWatchers ) . map ( function ( computedKey ) {
9940
+ void 0 , keys$1 ( this . vm . _computedWatchers ) . map ( function ( computedKey ) {
9941
9941
var obj ;
9942
9942
9943
9943
return ( ( obj = { } , obj [ computedKey ] = this$1 . vm [ computedKey ] , obj ) ) ;
@@ -9961,9 +9961,7 @@ Wrapper.prototype.overview = function overview () {
9961
9961
var emittedJSONReplacer = function ( key , value ) { return value instanceof Array
9962
9962
? value . map ( function ( calledWith , index ) {
9963
9963
var callParams = calledWith . map ( function ( param ) { return typeof param === 'object'
9964
- ? JSON . stringify ( param )
9965
- . replace ( / " / g, '' )
9966
- . replace ( / , / g, ', ' )
9964
+ ? JSON . stringify ( param ) . replace ( / " / g, '' ) . replace ( / , / g, ', ' )
9967
9965
: param ; }
9968
9966
) ;
9969
9967
@@ -10145,7 +10143,7 @@ Wrapper.prototype.setMethods = function setMethods (methods) {
10145
10143
}
10146
10144
this . __warnIfDestroyed ( ) ;
10147
10145
10148
- Object . keys ( methods ) . forEach ( function ( key ) {
10146
+ keys$1 ( methods ) . forEach ( function ( key ) {
10149
10147
// $FlowIgnore : Problem with possibly null this.vm
10150
10148
this$1 . vm [ key ] = methods [ key ] ;
10151
10149
// $FlowIgnore : Problem with possibly null this.vm
@@ -10184,11 +10182,10 @@ Wrapper.prototype.setProps = function setProps (data) {
10184
10182
10185
10183
this . __warnIfDestroyed ( ) ;
10186
10184
10187
- Object . keys ( data ) . forEach ( function ( key ) {
10185
+ keys$1 ( data ) . forEach ( function ( key ) {
10188
10186
// Don't let people set entire objects, because reactivity won't work
10189
10187
if (
10190
- typeof data [ key ] === 'object' &&
10191
- data [ key ] !== null &&
10188
+ isPlainObject ( data [ key ] ) &&
10192
10189
// $FlowIgnore : Problem with possibly null this.vm
10193
10190
data [ key ] === this$1 . vm [ key ]
10194
10191
) {
@@ -12919,7 +12916,7 @@ function _createLocalVue(
12919
12916
var instance = _Vue . extend ( ) ;
12920
12917
12921
12918
// clone global APIs
12922
- Object . keys ( _Vue ) . forEach ( function ( key ) {
12919
+ keys$1 ( _Vue ) . forEach ( function ( key ) {
12923
12920
if ( ! instance . hasOwnProperty ( key ) ) {
12924
12921
var original = _Vue [ key ] ;
12925
12922
// cloneDeep can fail when cloning Vue instances
@@ -12996,7 +12993,7 @@ function compileTemplate(component) {
12996
12993
}
12997
12994
12998
12995
if ( component . components ) {
12999
- Object . keys ( component . components ) . forEach ( function ( c ) {
12996
+ keys$1 ( component . components ) . forEach ( function ( c ) {
13000
12997
var cmp = component . components [ c ] ;
13001
12998
if ( ! cmp . render ) {
13002
12999
compileTemplate ( cmp ) ;
@@ -13014,7 +13011,7 @@ function compileTemplate(component) {
13014
13011
}
13015
13012
13016
13013
function compileTemplateForSlots ( slots ) {
13017
- Object . keys ( slots ) . forEach ( function ( key ) {
13014
+ keys$1 ( slots ) . forEach ( function ( key ) {
13018
13015
var slot = Array . isArray ( slots [ key ] ) ? slots [ key ] : [ slots [ key ] ] ;
13019
13016
slot . forEach ( function ( slotValue ) {
13020
13017
if ( componentNeedsCompiling ( slotValue ) ) {
@@ -13041,7 +13038,7 @@ function requiresTemplateCompiler(slot) {
13041
13038
}
13042
13039
13043
13040
function validateSlots ( slots ) {
13044
- Object . keys ( slots ) . forEach ( function ( key ) {
13041
+ keys$1 ( slots ) . forEach ( function ( key ) {
13045
13042
var slot = Array . isArray ( slots [ key ] ) ? slots [ key ] : [ slots [ key ] ] ;
13046
13043
13047
13044
slot . forEach ( function ( slotValue ) {
@@ -13245,7 +13242,7 @@ function addMocks(
13245
13242
if ( mockedProperties === false ) {
13246
13243
return
13247
13244
}
13248
- Object . keys ( mockedProperties ) . forEach ( function ( key ) {
13245
+ keys$1 ( mockedProperties ) . forEach ( function ( key ) {
13249
13246
try {
13250
13247
// $FlowIgnore
13251
13248
_Vue . prototype [ key ] = mockedProperties [ key ] ;
@@ -13280,7 +13277,7 @@ function logEvents(
13280
13277
13281
13278
function addEventLogger ( _Vue ) {
13282
13279
_Vue . mixin ( {
13283
- beforeCreate : function ( ) {
13280
+ beforeCreate : function ( ) {
13284
13281
this . __emitted = Object . create ( null ) ;
13285
13282
this . __emittedByOrder = [ ] ;
13286
13283
logEvents ( this , this . __emitted , this . __emittedByOrder ) ;
@@ -13328,9 +13325,7 @@ function isDestructuringSlotScope(slotScope) {
13328
13325
return / ^ { .* } $ / . test ( slotScope )
13329
13326
}
13330
13327
13331
- function getVueTemplateCompilerHelpers (
13332
- _Vue
13333
- ) {
13328
+ function getVueTemplateCompilerHelpers ( _Vue ) {
13334
13329
// $FlowIgnore
13335
13330
var vue = new _Vue ( ) ;
13336
13331
var helpers = { } ;
@@ -13429,7 +13424,7 @@ function createScopedSlots(
13429
13424
13430
13425
var slotScope = scopedSlotMatches . match && scopedSlotMatches . match [ 1 ] ;
13431
13426
13432
- scopedSlots [ scopedSlotName ] = function ( props ) {
13427
+ scopedSlots [ scopedSlotName ] = function ( props ) {
13433
13428
var obj ;
13434
13429
13435
13430
var res ;
@@ -13478,10 +13473,10 @@ function resolveComponent$1(obj, component) {
13478
13473
)
13479
13474
}
13480
13475
13481
- function getCoreProperties ( componentOptions ) {
13476
+ function getCoreProperties ( componentOptions , name ) {
13482
13477
return {
13483
13478
attrs : componentOptions . attrs ,
13484
- name : componentOptions . name ,
13479
+ name : componentOptions . name || name ,
13485
13480
model : componentOptions . model ,
13486
13481
props : componentOptions . props ,
13487
13482
on : componentOptions . on ,
@@ -13542,7 +13537,7 @@ function createStubFromComponent(
13542
13537
Vue__default [ 'default' ] . config . ignoredElements . push ( tagName ) ;
13543
13538
}
13544
13539
13545
- return Object . assign ( { } , getCoreProperties ( componentOptions ) ,
13540
+ return Object . assign ( { } , getCoreProperties ( componentOptions , name ) ,
13546
13541
{ $_vueTestUtils_original : originalComponent ,
13547
13542
$_doNotStubChildren : true ,
13548
13543
render : function render ( h , context ) {
@@ -13627,7 +13622,7 @@ function createStubsFromStubsObject(
13627
13622
) {
13628
13623
if ( originalComponents === void 0 ) originalComponents = { } ;
13629
13624
13630
- return Object . keys ( stubs || { } ) . reduce ( function ( acc , stubName ) {
13625
+ return keys$1 ( stubs || { } ) . reduce ( function ( acc , stubName ) {
13631
13626
var stub = stubs [ stubName ] ;
13632
13627
13633
13628
validateStub ( stub ) ;
@@ -13723,8 +13718,16 @@ function patchCreateElement(_Vue, stubs, stubAllComponents) {
13723
13718
}
13724
13719
13725
13720
if ( isConstructor ( el ) || isComponentOptions ( el ) ) {
13721
+ var componentOptions = isConstructor ( el ) ? el . options : el ;
13722
+ var elName = componentOptions . name ;
13723
+
13724
+ var stubbedComponent = resolveComponent ( elName , stubs ) ;
13725
+ if ( stubbedComponent ) {
13726
+ return originalCreateElement . apply ( void 0 , [ stubbedComponent ] . concat ( args ) )
13727
+ }
13728
+
13726
13729
if ( stubAllComponents ) {
13727
- var stub = createStubFromComponent ( el , el . name || 'anonymous' , _Vue ) ;
13730
+ var stub = createStubFromComponent ( el , elName || 'anonymous' , _Vue ) ;
13728
13731
return originalCreateElement . apply ( void 0 , [ stub ] . concat ( args ) )
13729
13732
}
13730
13733
var Constructor = shouldExtend ( el ) ? extend ( el , _Vue ) : el ;
@@ -13837,8 +13840,8 @@ function createInstance(
13837
13840
13838
13841
// watchers provided in mounting options should override preexisting ones
13839
13842
if ( componentOptions . watch && instanceOptions . watch ) {
13840
- var componentWatchers = Object . keys ( componentOptions . watch ) ;
13841
- var instanceWatchers = Object . keys ( instanceOptions . watch ) ;
13843
+ var componentWatchers = keys$1 ( componentOptions . watch ) ;
13844
+ var instanceWatchers = keys$1 ( instanceOptions . watch ) ;
13842
13845
13843
13846
for ( var i = 0 ; i < instanceWatchers . length ; i ++ ) {
13844
13847
var k = instanceWatchers [ i ] ;
@@ -13858,22 +13861,22 @@ function createInstance(
13858
13861
var parentComponentOptions = options . parentComponent || { } ;
13859
13862
13860
13863
var originalParentComponentProvide = parentComponentOptions . provide ;
13861
- parentComponentOptions . provide = function ( ) {
13864
+ parentComponentOptions . provide = function ( ) {
13862
13865
return Object . assign ( { } , getValuesFromCallableOption . call ( this , originalParentComponentProvide ) ,
13863
13866
// $FlowIgnore
13864
13867
getValuesFromCallableOption . call ( this , options . provide ) )
13865
13868
} ;
13866
13869
13867
13870
var originalParentComponentData = parentComponentOptions . data ;
13868
- parentComponentOptions . data = function ( ) {
13871
+ parentComponentOptions . data = function ( ) {
13869
13872
return Object . assign ( { } , getValuesFromCallableOption . call ( this , originalParentComponentData ) ,
13870
13873
{ vueTestUtils_childProps : Object . assign ( { } , options . propsData ) } )
13871
13874
} ;
13872
13875
13873
13876
parentComponentOptions . $_doNotStubChildren = true ;
13874
13877
parentComponentOptions . $_isWrapperParent = true ;
13875
13878
parentComponentOptions . _isFunctionalContainer = componentOptions . functional ;
13876
- parentComponentOptions . render = function ( h ) {
13879
+ parentComponentOptions . render = function ( h ) {
13877
13880
return h (
13878
13881
Constructor ,
13879
13882
createContext ( options , scopedSlots , this . vueTestUtils_childProps ) ,
0 commit comments