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

browser-monkey

Package Overview
Dependencies
Maintainers
2
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-monkey - npm Package Compare versions

Comparing version 1.25.0 to 1.26.0

0

dispatchEvent.js

@@ -0,0 +0,0 @@ module.exports = function dispatchEvent(el, type){

62

index.js

@@ -77,17 +77,3 @@ var retry = require('trytryagain');

function elementFinder(css) {
return {
find: function(element) {
var els = $(element).find(css);
if (els.length > 0) {
return els;
}
},
toString: function() {
return css;
}
};
}
function assertElementProperties(elements, expected, getProperty, exact) {

@@ -221,5 +207,46 @@ function assertion(actual, expected) {

this.finders = finders || [];
this.options = options || { visibleOnly: true };
this.handlers = [];
}
Selector.prototype.set = function(options){
var self = this;
Object.keys(options).forEach(function(key){
self.options[key] = options[key];
});
return this;
}
Selector.prototype.get = function(key){
return this.options[key];
}
function filterInvisible(index){
var el = this[index] || this;
var ignoreVisibilityOfTags = ['OPTION'];
if (el && ignoreVisibilityOfTags.indexOf(el.tagName) !== -1) {
el = el.parentNode;
}
return $(el).is(':visible');
}
Selector.prototype.elementFinder = function(css) {
var self = this;
return {
find: function(element) {
var els = $(element).find(css);
if (self.get('visibleOnly')) {
els = els.filter(filterInvisible);
}
if (els.length > 0) {
return els;
}
},
toString: function() {
return css;
}
};
}
Selector.prototype.clone = function (extension) {

@@ -262,3 +289,3 @@ var clone = new this.constructor();

var message = JSON.stringify(options);
var scope = this.addFinder(elementFinder(selector));
var scope = this.addFinder(this.elementFinder(selector));

@@ -312,3 +339,3 @@ if (options) {

var message = options && JSON.stringify(options);
var findElements = elementFinder(selector);
var findElements = this.elementFinder(selector);
var finder;

@@ -594,4 +621,5 @@

function inferField(component, field){
var ignoreActions = {constructor: true, options: true};
for (var action in component) {
if (field[action] && action !== 'constructor'){
if (field[action] && !ignoreActions[action]){
var newField = {

@@ -598,0 +626,0 @@ name: field[action],

@@ -0,0 +0,0 @@ // Karma configuration

{
"name": "browser-monkey",
"version": "1.25.0",
"version": "1.26.0",
"description": "reliable dom testing",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,0 +0,0 @@ # browser monkey

@@ -0,0 +0,0 @@ var dispatchEvent = require('./dispatchEvent');

@@ -0,0 +0,0 @@ function dispatchEvent(el, type, char) {

@@ -93,4 +93,32 @@ require('lie/polyfill');

});
describe('visibility', function(){
it('should not find an element that is visually hidden', function(){
insertHtml('<div class="element">hello <span style="display:none;">world</span></div>');
return browser.find('.element > span').shouldNotExist();
});
it('should find an element that is visually hidden when visibleOnly = false', function(){
insertHtml('<div class="element">hello <span style="display:none;">world</span></div>');
return browser.set({visibleOnly: false}).find('.element > span').shouldExist();
});
it('should find elements that are visually hidden because of how html renders them', function(){
insertHtml('<select><option>First</option><option>Second</option></select>');
return browser.find('select option').shouldHave({text: ['First', 'Second']});
});
});
});
describe('set option', function(){
it('can set an option that is inerhited by components', function(){
var parentComponent = browser.find('div').component({});
parentComponent.set({myOption: 'abc'});
var childComponent = parentComponent.find('div').component({});
expect(childComponent.get('myOption')).to.equal('abc');
});
});
describe('is', function () {

@@ -97,0 +125,0 @@ it('should eventually find an element if it has a class', function () {

@@ -0,0 +0,0 @@ module.exports = function() {

@@ -0,0 +0,0 @@ var createTestDiv = require('./createTestDiv');

@@ -0,0 +0,0 @@ var trace = require('../trace');

@@ -0,0 +0,0 @@ module.exports = function(promise) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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