@@ -2527,13 +2527,13 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
25272527
25282528 function objectWithoutProperties ( obj , exclude ) { var target = { } ; for ( var k in obj ) if ( Object . prototype . hasOwnProperty . call ( obj , k ) && exclude . indexOf ( k ) === - 1 ) target [ k ] = obj [ k ] ; return target ; }
25292529
2530- function createContext ( options , scopedSlots ) {
2530+ function createContext ( options , scopedSlots , currentProps ) {
25312531 var on = Object . assign ( { } , ( options . context && options . context . on ) ,
25322532 options . listeners ) ;
25332533 return Object . assign ( { } , { attrs : Object . assign ( { } , options . attrs ,
25342534 // pass as attrs so that inheritAttrs works correctly
2535- // propsData should take precedence over attrs
2536- options . propsData ) } ,
2535+ // props should take precedence over attrs
2536+ currentProps ) } ,
25372537 ( options . context || { } ) ,
25382538 { on : on ,
25392539 scopedSlots : scopedSlots } )
@@ -2622,15 +2622,23 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
26222622 var originalParentComponentProvide = parentComponentOptions . provide ;
26232623 parentComponentOptions . provide = function ( ) {
26242624 return Object . assign ( { } , getValuesFromCallableOption . call ( this , originalParentComponentProvide ) ,
2625+ // $FlowIgnore
26252626 getValuesFromCallableOption . call ( this , options . provide ) )
26262627 } ;
26272628
2629+ var originalParentComponentData = parentComponentOptions . data ;
2630+ parentComponentOptions . data = function ( ) {
2631+ return Object . assign ( { } , getValuesFromCallableOption . call ( this , originalParentComponentData ) ,
2632+ { vueTestUtils_childProps : Object . assign ( { } , options . propsData ) } )
2633+ } ;
2634+
26282635 parentComponentOptions . $_doNotStubChildren = true ;
2636+ parentComponentOptions . $_isWrapperParent = true ;
26292637 parentComponentOptions . _isFunctionalContainer = componentOptions . functional ;
26302638 parentComponentOptions . render = function ( h ) {
26312639 return h (
26322640 Constructor ,
2633- createContext ( options , scopedSlots ) ,
2641+ createContext ( options , scopedSlots , this . vueTestUtils_childProps ) ,
26342642 createChildren ( this , h , options )
26352643 )
26362644 } ;
@@ -2892,13 +2900,14 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
28922900 vm . _error = error ;
28932901 }
28942902
2903+ if ( ! instancedErrorHandlers . length ) {
2904+ throw error
2905+ }
28952906 // should be one error handler, as only once can be registered with local vue
28962907 // regardless, if more exist (for whatever reason), invoke the other user defined error handlers
28972908 instancedErrorHandlers . forEach ( function ( instancedErrorHandler ) {
28982909 instancedErrorHandler ( error , vm , info ) ;
28992910 } ) ;
2900-
2901- throw error
29022911 }
29032912
29042913 function throwIfInstancesThrew ( vm ) {
@@ -3022,7 +3031,6 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
30223031 mocks : { } ,
30233032 methods : { } ,
30243033 provide : { } ,
3025- silent : true ,
30263034 showDeprecationWarnings :
30273035 true
30283036 } ;
@@ -11037,71 +11045,49 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
1103711045 if ( ! this . vm ) {
1103811046 throwError ( "wrapper.setProps() can only be called on a Vue instance" ) ;
1103911047 }
11040- this . __warnIfDestroyed ( ) ;
11041-
11042- // Save the original "silent" config so that we can directly mutate props
11043- var originalConfig = Vue__default [ 'default' ] . config . silent ;
11044- Vue__default [ 'default' ] . config . silent = config . silent ;
1104511048
11046- try {
11047- Object . keys ( data ) . forEach ( function ( key ) {
11048- // Don't let people set entire objects, because reactivity won't work
11049- if (
11050- typeof data [ key ] === 'object' &&
11051- data [ key ] !== null &&
11052- // $FlowIgnore : Problem with possibly null this.vm
11053- data [ key ] === this$1 . vm [ key ]
11054- ) {
11055- throwError (
11056- "wrapper.setProps() called with the same object of the existing " +
11057- key + " property. You must call wrapper.setProps() with a new " +
11058- "object to trigger reactivity"
11059- ) ;
11060- }
11049+ // $FlowIgnore : Problem with possibly null this.vm
11050+ if ( ! this . vm . $parent . $options . $_isWrapperParent ) {
11051+ throwError (
11052+ "wrapper.setProps() can only be called for top-level component"
11053+ ) ;
11054+ }
1106111055
11062- if (
11063- ! this$1 . vm ||
11064- ! this$1 . vm . $options . _propKeys ||
11065- ! this$1 . vm . $options . _propKeys . some ( function ( prop ) { return prop === key ; } )
11066- ) {
11067- if ( VUE_VERSION > 2.3 ) {
11068- // $FlowIgnore : Problem with possibly null this.vm
11069- this$1 . vm . $attrs [ key ] = data [ key ] ;
11070- return nextTick ( )
11071- }
11072- throwError (
11073- "wrapper.setProps() called with " + key + " property which " +
11074- "is not defined on the component"
11075- ) ;
11076- }
11056+ this . __warnIfDestroyed ( ) ;
1107711057
11078- // Actually set the prop
11058+ Object . keys ( data ) . forEach ( function ( key ) {
11059+ // Don't let people set entire objects, because reactivity won't work
11060+ if (
11061+ typeof data [ key ] === 'object' &&
11062+ data [ key ] !== null &&
1107911063 // $FlowIgnore : Problem with possibly null this.vm
11080- this$1 . vm [ key ] = data [ key ] ;
11081- } ) ;
11064+ data [ key ] === this$1 . vm [ key ]
11065+ ) {
11066+ throwError (
11067+ "wrapper.setProps() called with the same object of the existing " +
11068+ key + " property. You must call wrapper.setProps() with a new " +
11069+ "object to trigger reactivity"
11070+ ) ;
11071+ }
11072+
11073+ if (
11074+ VUE_VERSION <= 2.3 &&
11075+ ( ! this$1 . vm ||
11076+ ! this$1 . vm . $options . _propKeys ||
11077+ ! this$1 . vm . $options . _propKeys . some ( function ( prop ) { return prop === key ; } ) )
11078+ ) {
11079+ throwError (
11080+ "wrapper.setProps() called with " + key + " property which " +
11081+ "is not defined on the component"
11082+ ) ;
11083+ }
1108211084
1108311085 // $FlowIgnore : Problem with possibly null this.vm
11084- this . vm . $forceUpdate ( ) ;
11085- return new Promise ( function ( resolve ) {
11086- nextTick ( ) . then ( function ( ) {
11087- var isUpdated = Object . keys ( data ) . some ( function ( key ) {
11088- return (
11089- // $FlowIgnore : Problem with possibly null this.vm
11090- this$1 . vm [ key ] === data [ key ] ||
11091- // $FlowIgnore : Problem with possibly null this.vm
11092- ( this$1 . vm . $attrs && this$1 . vm . $attrs [ key ] === data [ key ] )
11093- )
11094- } ) ;
11095- return ! isUpdated ? this$1 . setProps ( data ) . then ( resolve ( ) ) : resolve ( )
11096- } ) ;
11097- } )
11098- } catch ( err ) {
11099- throw err
11100- } finally {
11101- // Ensure you teardown the modifications you made to the user's config
11102- // After all the props are set, then reset the state
11103- Vue__default [ 'default' ] . config . silent = originalConfig ;
11104- }
11086+ var parent = this$1 . vm . $parent ;
11087+ parent . $set ( parent . vueTestUtils_childProps , key , data [ key ] ) ;
11088+ } ) ;
11089+
11090+ return nextTick ( )
1110511091 } ;
1110611092
1110711093 /**
0 commit comments