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

mock-browser

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mock-browser - npm Package Compare versions

Comparing version 0.90.33 to 0.91.34

74

lib/MockBrowser.js

@@ -8,3 +8,3 @@ /**

var dash = require('lodash' ),
jsdom = require('node-jsdom' ).jsdom,
jsdom = require('jsdom' ).jsdom,
AbstractBrowser = require('../lib/AbstractBrowser' ),

@@ -17,6 +17,8 @@ MockStorage = require('../lib/MockStorage');

var doc = jsdom('<!DOCTYPE html><html><body></body></html>' ),
win = doc.parentWindow,
win = doc.defaultView,
opts;
if (!options) options = {};
if (!options) {
options = {};
}

@@ -35,68 +37,2 @@ if (!win.localStorage) {

AbstractBrowser.extend( this, opts );
// work around for un-implemented classList in jsdom
doc.__createElement = doc.createElement;
doc.createElement = function(tag) {
var el = doc.__createElement( tag );
el.classList = new ClassList( el );
return el;
};
// class list work around
var ClassList = function(elem) {
var clist = this;
var getList = function() {
return elem.className.split(' ');
};
this.add = function(cname) {
var list = getList();
// don't push if it exists
if (!dash.contains( list, cname )) {
list.push( cname );
}
elem.className = list.join( ' ' ).trim();
};
this.remove = function(cname) {
var list = getList().filter(function(nm) {
if (nm !== cname) {
return nm;
}
});
elem.className = list.join( ' ' ).trim();
};
this.toggle = function(cname) {
var list = getList();
if (list.indexOf( cname ) < 0) {
clist.add( cname );
} else {
clist.remove( cname );
}
return list.indexOf( cname ) >= 0;
};
this.contains = function(cname) {
return elem.className.indexOf( cname ) >= 0;
};
this.toString = function() {
return getList().toString();
};
this.valueOf = function() {
return getList();
};
};
};

@@ -103,0 +39,0 @@

6

package.json
{
"name": "mock-browser",
"version": "0.90.33",
"version": "0.91.34",
"description": "A mock browser with window, document, location, navigation, local and session storage to use for client side code tests in a node environment.",

@@ -24,4 +24,4 @@ "repository": {

"dependencies": {
"node-jsdom": "^3.1.3",
"lodash": "^3.6.0"
"jsdom": "^6.5.0",
"lodash": "^3.10.1"
},

@@ -28,0 +28,0 @@ "devDependencies": {

@@ -150,2 +150,2 @@ #Mock Browser

- - -
<p><small><em>copyright © 2014-2015 rain city software | version 0.90.33</em></small></p>
<p><small><em>copyright © 2014-2015 rain city software | version 0.91.34</em></small></p>

@@ -9,3 +9,3 @@ /**

dash = require('lodash' ),
jsdom = require('node-jsdom' ).jsdom,
jsdom = require('jsdom' ).jsdom,
MockLogger = require('simple-node-logger' ).mocks.MockLogger,

@@ -21,3 +21,3 @@ MockStorage = require('../lib/MockStorage' ),

doc = jsdom('<div />' ),
win = doc.parentWindow;
win = doc.defaultView;

@@ -24,0 +24,0 @@ opts.window = win;

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