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.5 to 1.0.0-beta.6

104

dist/vue-test-utils.js

@@ -244,3 +244,3 @@ 'use strict';

//
//

@@ -336,3 +336,3 @@ var selectorTypes = {

//
//

@@ -363,3 +363,3 @@ function nodeMatchesSelector (node, selector) {

//
//

@@ -380,2 +380,14 @@

WrapperArray.prototype.attributes = function attributes () {
this.throwErrorIfWrappersIsEmpty('attributes');
throwError('attributes must be called on a single wrapper, use at(i) to access a wrapper');
};
WrapperArray.prototype.classes = function classes () {
this.throwErrorIfWrappersIsEmpty('classes');
throwError('classes must be called on a single wrapper, use at(i) to access a wrapper');
};
WrapperArray.prototype.contains = function contains (selector) {

@@ -468,2 +480,8 @@ this.throwErrorIfWrappersIsEmpty('contains');

WrapperArray.prototype.props = function props () {
this.throwErrorIfWrappersIsEmpty('props');
throwError('props must be called on a single wrapper, use at(i) to access a wrapper');
};
WrapperArray.prototype.text = function text () {

@@ -532,2 +550,10 @@ this.throwErrorIfWrappersIsEmpty('text');

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

@@ -593,2 +619,6 @@ throwError(("find did not return " + (this.selector) + ", cannot call contains() on empty Wrapper"));

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

@@ -641,2 +671,37 @@ throwError(("find did not return " + (this.selector) + ", cannot call text() on empty Wrapper"));

/**
* Returns an Object containing all the attribute/value pairs on the element.
*/
Wrapper.prototype.attributes = function attributes () {
var attributes = [].concat( this.element.attributes ); // NameNodeMap is not iterable
var attributeMap = {};
attributes.forEach(function (att) {
attributeMap[att.localName] = att.value;
});
return attributeMap
};
/**
* Returns an Array containing all the classes on the element
*/
Wrapper.prototype.classes = function classes () {
var this$1 = this;
var classes = [].concat( this.element.classList );
// Handle converting cssmodules identifiers back to the original class name
if (this.vm && this.vm.$style) {
var cssModuleIdentifiers = {};
var moduleIdent;
Object.keys(this.vm.$style).forEach(function (key) {
// $FlowIgnore : Flow thinks vm is a property
moduleIdent = this$1.vm.$style[key];
// CSS Modules may be multi-class if they extend others. Extended classes should be already present in $style.
moduleIdent = moduleIdent.split(' ')[0];
cssModuleIdentifiers[moduleIdent] = key;
});
classes = classes.map(function (className) { return cssModuleIdentifiers[className] || className; });
}
return classes
};
/**
* Checks if wrapper contains provided selector.

@@ -670,6 +735,9 @@ */

*/
Wrapper.prototype.emitted = function emitted () {
Wrapper.prototype.emitted = function emitted (event) {
if (!this._emitted && !this.vm) {
throwError('wrapper.emitted() can only be called on a Vue instance');
}
if (event) {
return this._emitted[event]
}
return this._emitted

@@ -920,2 +988,20 @@ };

/**
* Returns an Object containing the prop name/value pairs on the element
*/
Wrapper.prototype.props = function props () {
if (!this.isVueComponent) {
throwError('wrapper.props() must be called on a Vue instance');
}
// $props object does not exist in Vue 2.1.x, so use $options.propsData instead
var _props;
if (this.vm && this.vm.$options && this.vm.$options.propsData) {
_props = this.vm.$options.propsData;
} else {
// $FlowIgnore
_props = this.vm.$props;
}
return _props || {} // Return an empty object if no props exist
};
/**
* Sets vm data

@@ -1433,3 +1519,3 @@ */

//
//
function getStubs (optionStubs) {

@@ -1474,3 +1560,3 @@ if (optionStubs || Object.keys(config.stubs).length > 0) {

//
//

@@ -1578,3 +1664,3 @@ function isValidSlot (slot) {

//
//

@@ -1607,3 +1693,3 @@ function createElement () {

//
//

@@ -1635,3 +1721,3 @@ Vue.config.productionTip = false;

//
//

@@ -1638,0 +1724,0 @@ function shallow (component, options) {

3

package.json
{
"name": "vue-test-utils",
"version": "1.0.0-beta.5",
"version": "1.0.0-beta.6",
"description": "Utilities for testing Vue components.",

@@ -15,2 +15,3 @@ "main": "dist/vue-test-utils.js",

"docs:deploy": "build/update-docs.sh",
"docs:serve": "cd docs && gitbook serve",
"flow": "flow check",

@@ -17,0 +18,0 @@ "lint": "eslint --ext js,vue src test flow build --ignore-path .gitignore",

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

emitted (): { [name: string]: Array<Array<any>> }
emitted (event?: string): { [name: string]: Array<Array<any>> }
emittedByOrder (): Array<{ name: string, args: Array<any> }>

@@ -85,0 +85,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