marionette-helper
Advanced tools
Comparing version 0.0.4 to 0.0.5
24
index.js
@@ -95,3 +95,3 @@ var Marionette = require('marionette-client'); | ||
var next = this._waitFor.bind( | ||
this, test, callback, timeout - interval, interval); | ||
this, test, callback, interval, timeout - interval); | ||
setTimeout(next, interval); | ||
@@ -109,3 +109,3 @@ }, | ||
if (el instanceof Marionette.Element) { | ||
if (isElement(el)) { | ||
client.waitFor(function() { return el.displayed(); }); | ||
@@ -116,5 +116,21 @@ return el; | ||
var result = client.findElement(el); | ||
return this.waitForElement( | ||
(result instanceof Marionette.Element) ? result : el); | ||
return this.waitForElement(isElement(result) ? result : el); | ||
} | ||
}; | ||
/** | ||
* @param {Object} maybeElement something that could or could not be an el. | ||
* @return {boolean} Whether or not we have an element. | ||
* @private | ||
*/ | ||
function isElement(maybeElement) { | ||
if (!maybeElement) { | ||
return false; | ||
} | ||
if (maybeElement instanceof Marionette.Element) { | ||
return true; | ||
} | ||
return typeof(maybeElement.id) === 'string' && maybeElement.client; | ||
} |
{ | ||
"name": "marionette-helper", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Gareth Aye", |
@@ -27,3 +27,3 @@ suite('MarionetteHelper', function() { | ||
done(); | ||
}); | ||
}, 50, 1000); | ||
}); | ||
@@ -30,0 +30,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6639
160
0