-
Notifications
You must be signed in to change notification settings - Fork 663
Description
Version
1.0.0-beta.20
Reproduction link
https://codepen.io/sparlampe/pen/wxBqOy
Steps to reproduce
In a unit test try to use wrapper.setData to set a field of type date like so wrapper.setData(someDateField: new Date())
What is expected?
someDateField should be equal to the current date
What is actually happening?
if the default value is undefined, after setDate is executed, the field has value {}.
This seems to happen because of the merging of objects in the vue-test-utils code. At some point vue-test-util calculates the source object and the target object.
The target object is calculated as follows: Object(vm.someDateField) which gives {} if someDateField is initially undefined. The the source object is explored for keys like so: Object.keys(new Date()), which gives [].
So eventually we have an empty target object with no fields from the source object to be transferred to the target.