mock-browser
Advanced tools
Comparing version 0.90.33 to 0.91.34
@@ -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 @@ |
{ | ||
"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; |
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
23828
472
+ Addedjsdom@^6.5.0
+ Addedjsdom@6.5.1(transitive)
+ Addedsymbol-tree@3.2.4(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwhatwg-url-compat@0.6.5(transitive)
+ Addedxml-name-validator@2.0.1(transitive)
+ Addedxtend@4.0.2(transitive)
- Removednode-jsdom@^3.1.3
- Removedacorn@0.11.0(transitive)
- Removedbindings@1.5.0(transitive)
- Removedcontextify@0.1.15(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removednan@2.22.0(transitive)
- Removednode-jsdom@3.1.5(transitive)
- Removedxml-name-validator@1.0.0(transitive)
Updatedlodash@^3.10.1