vue-test-utils
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-beta.3
@@ -19,2 +19,10 @@ 'use strict'; | ||
if (typeof window === 'undefined') { | ||
throwError( | ||
'window is undefined, vue-test-utils needs to be run in a browser environment.\n' + | ||
'You can run the tests in node using jsdom + jsdom-global.\n' + | ||
'See https://vue-test-utils.vuejs.org/en/guides/common-tips.html for more details.' | ||
); | ||
} | ||
// | ||
@@ -609,7 +617,14 @@ | ||
Wrapper.prototype.hasClass = function hasClass (className) { | ||
if (typeof className !== 'string') { | ||
var targetClass = className; | ||
if (typeof targetClass !== 'string') { | ||
throwError('wrapper.hasClass() must be passed a string'); | ||
} | ||
return !!(this.element && this.element.classList.contains(className)) | ||
// if $style is available and has a matching target, use that instead. | ||
if (this.vm && this.vm.$style && this.vm.$style[targetClass]) { | ||
targetClass = this.vm.$style[targetClass]; | ||
} | ||
return !!(this.element && this.element.classList.contains(targetClass)) | ||
}; | ||
@@ -1174,11 +1189,3 @@ | ||
if (!window) { | ||
throwError( | ||
'window is undefined, vue-test-utils needs to be run in a browser environment.\n' + | ||
'You can run the tests in node using jsdom + jsdom-global.\n' + | ||
'See https://vue-test-utils.vuejs.org/en/guides/common-tips.html for more details.' | ||
); | ||
} | ||
var componentToMount = options.clone === false ? component : cloneDeep(component); | ||
var componentToMount = options.clone === false ? component : cloneDeep(component.extend ? component.options : component); | ||
// Remove cached constructor | ||
@@ -1204,3 +1211,3 @@ delete componentToMount._Ctor; | ||
var vue = options.localVue || Vue; | ||
var clonedComponent = cloneDeep(component); | ||
var clonedComponent = cloneDeep(component.extend ? component.options : component); | ||
@@ -1246,5 +1253,8 @@ if (clonedComponent.components) { | ||
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(instance, plugin); | ||
use.call.apply(use, [ instance, plugin ].concat( rest )); | ||
}; | ||
@@ -1251,0 +1261,0 @@ return instance |
{ | ||
"name": "vue-test-utils", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-beta.3", | ||
"description": "Utilities for testing Vue components.", | ||
@@ -86,3 +86,3 @@ "main": "dist/vue-test-utils.js", | ||
"typescript": "^2.4.1", | ||
"vue": "^2.4.4", | ||
"vue": "^2.5.2", | ||
"vue-loader": "^13.0.5", | ||
@@ -89,0 +89,0 @@ "vue-router": "^2.7.0", |
@@ -1,2 +0,2 @@ | ||
# vue-test-utils | ||
# vue-test-utils [![Build Status](https://circleci.com/gh/vuejs/vue-test-utils/tree/dev.png?style=shield)](https://circleci.com/gh/vuejs/vue-test-utils) | ||
@@ -7,6 +7,6 @@ ## Currently in beta | ||
// npm | ||
npm install --save-dev vue-test-utils@1.0.0-beta.1 | ||
npm install --save-dev vue-test-utils@latest | ||
// yarn | ||
yarn add --dev vue-test-utils@1.0.0-beta.1 | ||
yarn add --dev vue-test-utils@latest | ||
``` | ||
@@ -13,0 +13,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
364761
11103