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

window-mock

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

window-mock - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

.nvmrc

6

lib/class-list-mock.js
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -11,3 +11,3 @@ Object.defineProperty(exports, "__esModule", {

var ClassListMock = (function () {
var ClassListMock = function () {
function ClassListMock() {

@@ -50,4 +50,4 @@ _classCallCheck(this, ClassListMock);

return ClassListMock;
})();
}();
exports.default = ClassListMock;
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -11,3 +11,3 @@ Object.defineProperty(exports, "__esModule", {

var WindowApplicationCacheMock = (function () {
var WindowApplicationCacheMock = function () {
function WindowApplicationCacheMock() {

@@ -28,4 +28,4 @@ _classCallCheck(this, WindowApplicationCacheMock);

return WindowApplicationCacheMock;
})();
}();
exports.default = WindowApplicationCacheMock;
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -21,3 +21,3 @@ Object.defineProperty(exports, "__esModule", {

var WindowDocumentMock = (function () {
var WindowDocumentMock = function () {
function WindowDocumentMock() {

@@ -53,4 +53,4 @@ _classCallCheck(this, WindowDocumentMock);

return WindowDocumentMock;
})();
}();
exports.default = WindowDocumentMock;

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

var WindowFragmentMock = (function (_WindowNodeMock) {
var WindowFragmentMock = function (_WindowNodeMock) {
_inherits(WindowFragmentMock, _WindowNodeMock);

@@ -33,5 +33,4 @@

return WindowFragmentMock;
})(_windowNodeMock2.default);
}(_windowNodeMock2.default);
exports.default = WindowFragmentMock; // @see https://github.com/babel/babel/issues/2694
// Moved to EOF cause of Babel issue
exports.default = WindowFragmentMock;
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -11,3 +11,3 @@ Object.defineProperty(exports, "__esModule", {

var WindowLocalStorageMock = (function () {
var WindowLocalStorageMock = function () {
function WindowLocalStorageMock() {

@@ -38,4 +38,4 @@ _classCallCheck(this, WindowLocalStorageMock);

return WindowLocalStorageMock;
})();
}();
exports.default = WindowLocalStorageMock;
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); // Fake browser for testing
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Fake browser for testing

@@ -33,3 +33,3 @@ Object.defineProperty(exports, "__esModule", {

var WindowMock = (function () {
var WindowMock = function () {
function WindowMock() {

@@ -64,4 +64,4 @@ _classCallCheck(this, WindowMock);

return WindowMock;
})();
}();
exports.default = WindowMock;
'use strict';
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

@@ -17,3 +17,3 @@ Object.defineProperty(exports, "__esModule", {

var WindowNodeMock = (function () {
var WindowNodeMock = function () {
function WindowNodeMock() {

@@ -23,2 +23,3 @@ _classCallCheck(this, WindowNodeMock);

this._test = 'Node';
this._attributes = {};
this.children = [];

@@ -39,2 +40,12 @@ this.classList = new _classListMock2.default();

}, {
key: 'setAttribute',
value: function setAttribute(k, v) {
this._attributes[k] = v;
}
}, {
key: 'getAttribute',
value: function getAttribute(k) {
return this._attributes[k];
}
}, {
key: 'firstChild',

@@ -47,4 +58,4 @@ get: function get() {

return WindowNodeMock;
})();
}();
exports.default = WindowNodeMock;
{
"name": "window-mock",
"version": "0.0.7",
"version": "0.0.8",
"description": "A light-weight window mock for Node/io.js unit-testing",

@@ -17,17 +17,17 @@ "main": "lib/window-mock.js",

"devDependencies": {
"babel-cli": "6.1.4",
"babel-core": "6.1.4",
"babel-eslint": "4.1.4",
"babel-preset-es2015": "6.1.4",
"babel-runtime": "6.1.4",
"babel-tape-runner": "1.3.0",
"babel-cli": "6.9.0",
"babel-core": "6.7.4",
"babel-eslint": "4.1.8",
"babel-preset-es2015": "6.6.0",
"babel-runtime": "6.9.2",
"babel-tape-runner": "2.0.1",
"faucet": "0.0.1",
"grunt": "0.4.5",
"grunt": "1.0.1",
"grunt-cli": "0.1.13",
"grunt-eslint": "17.3.1",
"grunt-eslint": "18.0.0",
"grunt-shell": "1.1.2",
"load-grunt-config": "0.19.0",
"node-libs-browser": "0.5.3",
"tape": "4.0.1",
"time-grunt": "1.1.0"
"load-grunt-config": "0.19.1",
"node-libs-browser": "1.0.0",
"tape": "4.5.1",
"time-grunt": "1.3.0"
},

@@ -40,3 +40,3 @@ "license": "MIT",

],
"author": "Sebastian Misch <sbstnmsch~AT~google> (http://sebastian-misch.de/)"
"author": "Sebastian Misch <sbstnmsch~AT~google> (https://sebastian-misch.de/)"
}

@@ -64,2 +64,2 @@ [![npm version](https://badge.fury.io/js/window-mock.svg)](http://badge.fury.io/js/window-mock) [![Build Status](https://travis-ci.org/sbstnmsch/window-mock.svg?branch=master)](https://travis-ci.org/sbstnmsch/window-mock)

Feel free to fork and pull-request!
Feel free to fork and pull-request for extending the API!

@@ -1,2 +0,2 @@

export default class ClassListMock {
class ClassListMock {

@@ -30,1 +30,3 @@ constructor() {

}
export default ClassListMock;

@@ -1,2 +0,2 @@

export default class WindowApplicationCacheMock {
class WindowApplicationCacheMock {

@@ -14,1 +14,3 @@ constructor() {

}
export default WindowApplicationCacheMock;
import WindowNodeMock from './window-node-mock';
import WindowFragmentMock from './window-fragment-mock';
export default class WindowDocumentMock {
class WindowDocumentMock {

@@ -28,1 +28,3 @@ constructor() {

}
export default WindowDocumentMock;

@@ -12,3 +12,2 @@ import WindowNodeMock from './window-node-mock';

export default WindowFragmentMock; // @see https://github.com/babel/babel/issues/2694
// Moved to EOF cause of Babel issue
export default WindowFragmentMock;

@@ -1,2 +0,2 @@

export default class WindowLocalStorageMock {
class WindowLocalStorageMock {

@@ -21,1 +21,3 @@ constructor() {

}
export default WindowLocalStorageMock;

@@ -1,2 +0,2 @@

export default class WindowLocationMock {
class WindowLocationMock {

@@ -9,1 +9,3 @@ constructor() {

}
export default WindowLocationMock;

@@ -9,3 +9,3 @@ // Fake browser for testing

export default class WindowMock {
class WindowMock {

@@ -34,1 +34,3 @@ constructor() {

}
export default WindowMock;

@@ -1,2 +0,2 @@

export default class WindowNavigatorMock {
class WindowNavigatorMock {

@@ -9,1 +9,3 @@ constructor() {

}
export default WindowNavigatorMock;
import ClassListMock from './class-list-mock';
export default class WindowNodeMock {
class WindowNodeMock {
constructor() {
this._test = 'Node';
this._attributes = {};
this.children = [];

@@ -22,3 +23,12 @@ this.classList = new ClassListMock();

}
setAttribute(k, v) {
this._attributes[k] = v;
}
getAttribute(k) {
return this._attributes[k];
}
}
}
export default WindowNodeMock;

@@ -21,2 +21,6 @@ import test from 'tape';

mock.setAttribute('key', 'value');
t.equal(mock._attributes['key'], 'value', 'setAttribute should store key-value pairs');
t.equal(mock.getAttribute('key'), 'value', 'getAttribute should return value for a key');
t.end();

@@ -31,1 +35,8 @@ });

});
test(`${name}: window.document{Node}.attributes`, (t) => {
t.equal(typeof mock._attributes, 'object', 'should be an object');
t.end();
});

Sorry, the diff of this file is not supported yet

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