Skip to content

Commit

Permalink
chore: publish 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
afontcu committed Feb 4, 2021
1 parent 48100be commit c27d933
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 262 deletions.
113 changes: 49 additions & 64 deletions packages/server-test-utils/dist/vue-server-test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,6 @@ var config = {
mocks: {},
methods: {},
provide: {},
silent: true,
showDeprecationWarnings:
typeof process.env.SHOW_DEPRECATIONS !== 'undefined'
? process.env.SHOW_DEPRECATIONS
Expand Down Expand Up @@ -10142,71 +10141,49 @@ Wrapper.prototype.setProps = function setProps (data) {
if (!this.vm) {
throwError("wrapper.setProps() can only be called on a Vue instance");
}
this.__warnIfDestroyed();

// Save the original "silent" config so that we can directly mutate props
var originalConfig = Vue__default['default'].config.silent;
Vue__default['default'].config.silent = config.silent;

try {
Object.keys(data).forEach(function (key) {
// Don't let people set entire objects, because reactivity won't work
if (
typeof data[key] === 'object' &&
data[key] !== null &&
// $FlowIgnore : Problem with possibly null this.vm
data[key] === this$1.vm[key]
) {
throwError(
"wrapper.setProps() called with the same object of the existing " +
key + " property. You must call wrapper.setProps() with a new " +
"object to trigger reactivity"
);
}
// $FlowIgnore : Problem with possibly null this.vm
if (!this.vm.$parent.$options.$_isWrapperParent) {
throwError(
"wrapper.setProps() can only be called for top-level component"
);
}

if (
!this$1.vm ||
!this$1.vm.$options._propKeys ||
!this$1.vm.$options._propKeys.some(function (prop) { return prop === key; })
) {
if (VUE_VERSION > 2.3) {
// $FlowIgnore : Problem with possibly null this.vm
this$1.vm.$attrs[key] = data[key];
return nextTick()
}
throwError(
"wrapper.setProps() called with " + key + " property which " +
"is not defined on the component"
);
}
this.__warnIfDestroyed();

// Actually set the prop
Object.keys(data).forEach(function (key) {
// Don't let people set entire objects, because reactivity won't work
if (
typeof data[key] === 'object' &&
data[key] !== null &&
// $FlowIgnore : Problem with possibly null this.vm
this$1.vm[key] = data[key];
});
data[key] === this$1.vm[key]
) {
throwError(
"wrapper.setProps() called with the same object of the existing " +
key + " property. You must call wrapper.setProps() with a new " +
"object to trigger reactivity"
);
}

if (
VUE_VERSION <= 2.3 &&
(!this$1.vm ||
!this$1.vm.$options._propKeys ||
!this$1.vm.$options._propKeys.some(function (prop) { return prop === key; }))
) {
throwError(
"wrapper.setProps() called with " + key + " property which " +
"is not defined on the component"
);
}

// $FlowIgnore : Problem with possibly null this.vm
this.vm.$forceUpdate();
return new Promise(function (resolve) {
nextTick().then(function () {
var isUpdated = Object.keys(data).some(function (key) {
return (
// $FlowIgnore : Problem with possibly null this.vm
this$1.vm[key] === data[key] ||
// $FlowIgnore : Problem with possibly null this.vm
(this$1.vm.$attrs && this$1.vm.$attrs[key] === data[key])
)
});
return !isUpdated ? this$1.setProps(data).then(resolve()) : resolve()
});
})
} catch (err) {
throw err
} finally {
// Ensure you teardown the modifications you made to the user's config
// After all the props are set, then reset the state
Vue__default['default'].config.silent = originalConfig;
}
var parent = this$1.vm.$parent;
parent.$set(parent.vueTestUtils_childProps, key, data[key]);
});

return nextTick()
};

/**
Expand Down Expand Up @@ -13700,13 +13677,13 @@ function patchCreateElement(_Vue, stubs, stubAllComponents) {

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; }

function createContext(options, scopedSlots) {
function createContext(options, scopedSlots, currentProps) {
var on = Object.assign({}, (options.context && options.context.on),
options.listeners);
return Object.assign({}, {attrs: Object.assign({}, options.attrs,
// pass as attrs so that inheritAttrs works correctly
// propsData should take precedence over attrs
options.propsData)},
// props should take precedence over attrs
currentProps)},
(options.context || {}),
{on: on,
scopedSlots: scopedSlots})
Expand Down Expand Up @@ -13795,15 +13772,23 @@ function createInstance(
var originalParentComponentProvide = parentComponentOptions.provide;
parentComponentOptions.provide = function() {
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentProvide),
// $FlowIgnore
getValuesFromCallableOption.call(this, options.provide))
};

var originalParentComponentData = parentComponentOptions.data;
parentComponentOptions.data = function() {
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentData),
{vueTestUtils_childProps: Object.assign({}, options.propsData)})
};

parentComponentOptions.$_doNotStubChildren = true;
parentComponentOptions.$_isWrapperParent = true;
parentComponentOptions._isFunctionalContainer = componentOptions.functional;
parentComponentOptions.render = function(h) {
return h(
Constructor,
createContext(options, scopedSlots),
createContext(options, scopedSlots, this.vueTestUtils_childProps),
createChildren(this, h, options)
)
};
Expand Down
118 changes: 52 additions & 66 deletions packages/test-utils/dist/vue-test-utils.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -2527,13 +2527,13 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {

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; }

function createContext(options, scopedSlots) {
function createContext(options, scopedSlots, currentProps) {
var on = Object.assign({}, (options.context && options.context.on),
options.listeners);
return Object.assign({}, {attrs: Object.assign({}, options.attrs,
// pass as attrs so that inheritAttrs works correctly
// propsData should take precedence over attrs
options.propsData)},
// props should take precedence over attrs
currentProps)},
(options.context || {}),
{on: on,
scopedSlots: scopedSlots})
Expand Down Expand Up @@ -2622,15 +2622,23 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
var originalParentComponentProvide = parentComponentOptions.provide;
parentComponentOptions.provide = function() {
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentProvide),
// $FlowIgnore
getValuesFromCallableOption.call(this, options.provide))
};

var originalParentComponentData = parentComponentOptions.data;
parentComponentOptions.data = function() {
return Object.assign({}, getValuesFromCallableOption.call(this, originalParentComponentData),
{vueTestUtils_childProps: Object.assign({}, options.propsData)})
};

parentComponentOptions.$_doNotStubChildren = true;
parentComponentOptions.$_isWrapperParent = true;
parentComponentOptions._isFunctionalContainer = componentOptions.functional;
parentComponentOptions.render = function(h) {
return h(
Constructor,
createContext(options, scopedSlots),
createContext(options, scopedSlots, this.vueTestUtils_childProps),
createChildren(this, h, options)
)
};
Expand Down Expand Up @@ -2892,13 +2900,14 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
vm._error = error;
}

if (!instancedErrorHandlers.length) {
throw error
}
// should be one error handler, as only once can be registered with local vue
// regardless, if more exist (for whatever reason), invoke the other user defined error handlers
instancedErrorHandlers.forEach(function (instancedErrorHandler) {
instancedErrorHandler(error, vm, info);
});

throw error
}

function throwIfInstancesThrew(vm) {
Expand Down Expand Up @@ -3022,7 +3031,6 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
mocks: {},
methods: {},
provide: {},
silent: true,
showDeprecationWarnings:
true
};
Expand Down Expand Up @@ -11037,71 +11045,49 @@ var VueTestUtils = (function (exports, Vue, vueTemplateCompiler) {
if (!this.vm) {
throwError("wrapper.setProps() can only be called on a Vue instance");
}
this.__warnIfDestroyed();

// Save the original "silent" config so that we can directly mutate props
var originalConfig = Vue__default['default'].config.silent;
Vue__default['default'].config.silent = config.silent;

try {
Object.keys(data).forEach(function (key) {
// Don't let people set entire objects, because reactivity won't work
if (
typeof data[key] === 'object' &&
data[key] !== null &&
// $FlowIgnore : Problem with possibly null this.vm
data[key] === this$1.vm[key]
) {
throwError(
"wrapper.setProps() called with the same object of the existing " +
key + " property. You must call wrapper.setProps() with a new " +
"object to trigger reactivity"
);
}
// $FlowIgnore : Problem with possibly null this.vm
if (!this.vm.$parent.$options.$_isWrapperParent) {
throwError(
"wrapper.setProps() can only be called for top-level component"
);
}

if (
!this$1.vm ||
!this$1.vm.$options._propKeys ||
!this$1.vm.$options._propKeys.some(function (prop) { return prop === key; })
) {
if (VUE_VERSION > 2.3) {
// $FlowIgnore : Problem with possibly null this.vm
this$1.vm.$attrs[key] = data[key];
return nextTick()
}
throwError(
"wrapper.setProps() called with " + key + " property which " +
"is not defined on the component"
);
}
this.__warnIfDestroyed();

// Actually set the prop
Object.keys(data).forEach(function (key) {
// Don't let people set entire objects, because reactivity won't work
if (
typeof data[key] === 'object' &&
data[key] !== null &&
// $FlowIgnore : Problem with possibly null this.vm
this$1.vm[key] = data[key];
});
data[key] === this$1.vm[key]
) {
throwError(
"wrapper.setProps() called with the same object of the existing " +
key + " property. You must call wrapper.setProps() with a new " +
"object to trigger reactivity"
);
}

if (
VUE_VERSION <= 2.3 &&
(!this$1.vm ||
!this$1.vm.$options._propKeys ||
!this$1.vm.$options._propKeys.some(function (prop) { return prop === key; }))
) {
throwError(
"wrapper.setProps() called with " + key + " property which " +
"is not defined on the component"
);
}

// $FlowIgnore : Problem with possibly null this.vm
this.vm.$forceUpdate();
return new Promise(function (resolve) {
nextTick().then(function () {
var isUpdated = Object.keys(data).some(function (key) {
return (
// $FlowIgnore : Problem with possibly null this.vm
this$1.vm[key] === data[key] ||
// $FlowIgnore : Problem with possibly null this.vm
(this$1.vm.$attrs && this$1.vm.$attrs[key] === data[key])
)
});
return !isUpdated ? this$1.setProps(data).then(resolve()) : resolve()
});
})
} catch (err) {
throw err
} finally {
// Ensure you teardown the modifications you made to the user's config
// After all the props are set, then reset the state
Vue__default['default'].config.silent = originalConfig;
}
var parent = this$1.vm.$parent;
parent.$set(parent.vueTestUtils_childProps, key, data[key]);
});

return nextTick()
};

/**
Expand Down
Loading

0 comments on commit c27d933

Please sign in to comment.