browser-monkey
Advanced tools
Comparing version 1.22.0 to 1.23.0
@@ -134,2 +134,3 @@ var retry = require('trytryagain'); | ||
var value = options.option('value'); | ||
var exactValue = options.option('exactValue'); | ||
var html = options.option('html'); | ||
@@ -174,2 +175,6 @@ var checked = options.option('checked'); | ||
if (exactValue !== undefined) { | ||
assertElementProperties(els, exactValue, function (e) { return e.val(); }, true); | ||
} | ||
if (checked) { | ||
@@ -176,0 +181,0 @@ var elements = els.toArray(); |
{ | ||
"name": "browser-monkey", | ||
"version": "1.22.0", | ||
"version": "1.23.0", | ||
"description": "reliable dom testing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -265,2 +265,3 @@ # browser monkey | ||
* `options.value` - a string, expects the resolved element to be an input and have the value. An array expects the same number of inputs, each with the respective value. | ||
* `options.exactValue` - a string, expects the resolved scope to have the exact value. If an array of strings, expects the elements to have the same number of elements as there are strings in the array, and expects each string to equal each respective element's value. | ||
* `options.checked` - a boolean, expects the resolved element to be an checkbox input and to be checked or not. An array expects the same number of checkboxes, each with the respective checked value. | ||
@@ -267,0 +268,0 @@ * `options.html` - a string, expects the resolved element to have the html. An array expects the same number of elements, each with the respective html. |
@@ -50,2 +50,13 @@ require('lie/polyfill'); | ||
it('should eventually find an element with the right text', function () { | ||
var promise = browser.find('.element', {text: 'green'}).element(); | ||
$('<div class="element"></div>').appendTo(div); | ||
eventuallyInsertHtml('<div class="element">red</div><div class="element">blue</div><div class="element">green</div>'); | ||
return promise.then(function (element) { | ||
expect(element.innerText).to.equal('green'); | ||
}); | ||
}); | ||
it('filter fails with the right message', function () { | ||
@@ -507,2 +518,14 @@ var promise = browser.find('.element').filter(function (element) { | ||
it('finds an element with exact value', function () { | ||
var bad = browser.find('.element1 input').shouldHave({exactValue: 'some t'}); | ||
var good = browser.find('.element1 input').shouldHave({exactValue: 'some text'}); | ||
eventuallyInsertHtml('<div class="element1"><input type=text value="some text" /></div>'); | ||
return Promise.all([ | ||
good, | ||
expect(bad).to.be.rejected | ||
]); | ||
}); | ||
describe('exactText', function(){ | ||
@@ -509,0 +532,0 @@ it('eventually finds elements that have the exact array of text', function(){ |
70549
1504
413