Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-test-utils

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-test-utils - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0-beta.4

147

dist/vue-test-utils.js

@@ -439,2 +439,8 @@ 'use strict';

WrapperArray.prototype.destroy = function destroy () {
this.throwErrorIfWrappersIsEmpty('destroy');
this.wrappers.forEach(function (wrapper) { return wrapper.destroy(); });
};
//

@@ -537,2 +543,6 @@ var ErrorWrapper = function ErrorWrapper (selector) {

ErrorWrapper.prototype.destroy = function destroy () {
throwError(("find did not return " + (this.selector) + ", cannot call destroy() on empty Wrapper"));
};
//

@@ -618,2 +628,4 @@

Wrapper.prototype.hasClass = function hasClass (className) {
var this$1 = this;
var targetClass = className;

@@ -630,3 +642,7 @@

return !!(this.element && this.element.classList.contains(targetClass))
var containsAllClasses = targetClass
.split(' ')
.every(function (target) { return this$1.element.classList.contains(target); });
return !!(this.element && containsAllClasses)
};

@@ -913,2 +929,17 @@

/**
* Calls destroy on vm
*/
Wrapper.prototype.destroy = function destroy () {
if (!this.isVueComponent) {
throwError('wrapper.destroy() can only be called on a Vue instance');
}
if (this.element.parentNode) {
this.element.parentNode.removeChild(this.element);
}
// $FlowIgnore
this.vm.$destroy();
};
/**
* Dispatches a DOM event on wrapper

@@ -1057,6 +1088,6 @@ */

//
function addMocks (mockedProperties, Vue$$1) {
Object.keys(mockedProperties).forEach(function (key) {
Vue$$1.prototype[key] = mockedProperties[key];
Vue.util.defineReactive(Vue$$1, key, mockedProperties[key]);
});

@@ -1109,11 +1140,58 @@ }

function createConstructor (component, options) {
var vue = options.localVue || Vue;
function createLocalVue () {
var instance = Vue.extend();
if (options.context) {
if (!component.functional) {
throwError('mount.context can only be used when mounting a functional component');
// clone global APIs
Object.keys(Vue).forEach(function (key) {
if (!instance.hasOwnProperty(key)) {
var original = Vue[key];
instance[key] = typeof original === 'object'
? cloneDeep(original)
: original;
}
});
if (typeof options.context !== 'object') {
// config is not enumerable
instance.config = cloneDeep(Vue.config);
// option merge strategies need to be exposed by reference
// so that merge strats registered by plguins can work properly
instance.config.optionMergeStrategies = Vue.config.optionMergeStrategies;
// make sure all extends are based on this instance.
// this is important so that global components registered by plugins,
// e.g. router-link are created using the correct base constructor
instance.options._base = instance;
// compat for vue-router < 2.7.1 where it does not allow multiple installs
var use = instance.use;
instance.use = function (plugin) {
var rest = [], len = arguments.length - 1;
while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
if (plugin.installed === true) {
plugin.installed = false;
}
if (plugin.install && plugin.install.installed === true) {
plugin.install.installed = false;
}
use.call.apply(use, [ instance, plugin ].concat( rest ));
};
return instance
}
//
function createConstructor (
component,
options
) {
var vue = options.localVue || createLocalVue();
if (options.mocks) {
addMocks(options.mocks, vue);
}
if (component.functional) {
if (options.context && typeof options.context !== 'object') {
throwError('mount.context must be an object');

@@ -1124,5 +1202,12 @@ }

render: function render (h) {
return h(clonedComponent, options.context)
return h(
clonedComponent,
options.context || component.FunctionalRenderContext
)
}
};
} else if (options.context) {
throwError(
'mount.context can only be used when mounting a functional component'
);
}

@@ -1144,6 +1229,2 @@

if (options.mocks) {
addMocks(options.mocks, Constructor);
}
var vm = new Constructor(options);

@@ -1230,42 +1311,2 @@

function createLocalVue () {
var instance = Vue.extend();
// clone global APIs
Object.keys(Vue).forEach(function (key) {
if (!instance.hasOwnProperty(key)) {
var original = Vue[key];
instance[key] = typeof original === 'object'
? cloneDeep(original)
: original;
}
});
// config is not enumerable
instance.config = cloneDeep(Vue.config);
// option merge strategies need to be exposed by reference
// so that merge strats registered by plguins can work properly
instance.config.optionMergeStrategies = Vue.config.optionMergeStrategies;
// make sure all extends are based on this instance.
// this is important so that global components registered by plugins,
// e.g. router-link are created using the correct base constructor
instance.options._base = instance;
// compat for vue-router < 2.7.1 where it does not allow multiple installs
var use = instance.use;
instance.use = function (plugin) {
var rest = [], len = arguments.length - 1;
while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
plugin.installed = false;
plugin.install.installed = false;
use.call.apply(use, [ instance, plugin ].concat( rest ));
};
return instance
}
//
function getRealChild (vnode) {

@@ -1272,0 +1313,0 @@ var compOptions = vnode && vnode.componentOptions;

{
"name": "vue-test-utils",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"description": "Utilities for testing Vue components.",

@@ -86,6 +86,7 @@ "main": "dist/vue-test-utils.js",

"typescript": "^2.4.1",
"vue": "^2.5.2",
"vue": "^2.4.2",
"vue-loader": "^13.0.5",
"vue-router": "^2.7.0",
"vue-template-compiler": "^2.4.4",
"vue-template-compiler": "^2.4.2",
"vuetify": "^0.16.9",
"vuex": "^2.4.1",

@@ -92,0 +93,0 @@ "webpack": "^3.6.0",

@@ -51,2 +51,3 @@ import Vue, { VNodeData, Component, ComponentOptions, FunctionalComponentOptions } from 'vue'

trigger (eventName: string, options?: object): void
destroy (): void
}

@@ -53,0 +54,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc