browser-monkey
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -234,6 +234,4 @@ var retry = require('trytryagain'); | ||
var self = this; | ||
var interval = options && options.hasOwnProperty('interval') && options.interval !== undefined? options.interval: undefined; | ||
var duration = options && options.hasOwnProperty('duration') && options.duration !== undefined? options.duration: 100; | ||
return retry.ensuring({interval: interval, duration: duration}, function() { | ||
return retry(options, function() { | ||
var found = false; | ||
@@ -240,0 +238,0 @@ try { |
{ | ||
"name": "browser-monkey", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "reliable dom testing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -202,3 +202,3 @@ # browser monkey | ||
Wait a while for to be sure the element doesn't exist. | ||
Waits for the element not to exist. | ||
@@ -209,6 +209,6 @@ ```js | ||
* `options.duration` - the duration to wait (100ms) | ||
* `options.timeout` - length of time to wait for the element (1000ms) | ||
* `options.interval` - time between testing the dom (10ms) | ||
Returns a promise that resolves when the element doesn't exist, or is rejected if the timeout expires. | ||
Returns a promise that resolves when the element no longer exists, or is rejected if the timeout expires. | ||
@@ -215,0 +215,0 @@ ## shouldHave |
@@ -32,8 +32,13 @@ var browser = require('..'); | ||
describe('shouldNotExist', function () { | ||
it('should ensure that element never exists', function () { | ||
var good = browser.find('.not-element').shouldNotExist(); | ||
var bad = browser.find('.element').shouldNotExist(); | ||
it("should ensure that element eventually doesn't exists", function () { | ||
var elementToRemove = $('<div class="removing"></div>').appendTo(div); | ||
var elementToStay = $('<div class="staying"></div>').appendTo(div); | ||
eventuallyInsertHtml('<div class="element"></div>'); | ||
var good = browser.find('.removing').shouldNotExist(); | ||
var bad = browser.find('.staying').shouldNotExist(); | ||
setTimeout(function () { | ||
elementToRemove.remove(); | ||
}, 50); | ||
return Promise.all([ | ||
@@ -40,0 +45,0 @@ good, |
619
31402