browser-monkey
Advanced tools
Comparing version 1.15.9 to 1.15.10
{ | ||
"name": "browser-monkey", | ||
"version": "1.15.9", | ||
"version": "1.15.10", | ||
"description": "reliable dom testing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,6 +23,11 @@ function dispatchEvent(el, type, char) { | ||
for (var n = 0; n < text.length; ++n) { | ||
var char = text[n]; | ||
el.value = text.substring(0, n + 1); | ||
sendkey(el, char); | ||
if (text.length === 0) { | ||
sendkey(el, ''); | ||
el.value = ''; | ||
} else { | ||
for (var n = 0; n < text.length; ++n) { | ||
var char = text[n]; | ||
el.value = text.substring(0, n + 1); | ||
sendkey(el, char); | ||
} | ||
} | ||
@@ -29,0 +34,0 @@ |
@@ -259,2 +259,13 @@ require('lie/polyfill'); | ||
}); | ||
it('typing empty text blanks out existing text', function () { | ||
var firedEvents = []; | ||
insertHtml('<input type="text" class="element" value="good bye">') | ||
.on('input', function(){ firedEvents.push('input'); }); | ||
return browser.find('.element').typeIn('').then(function () { | ||
expect($(div).find('input.element').val()).to.equal(''); | ||
expect(firedEvents).to.eql(['input']) | ||
}); | ||
}); | ||
}); | ||
@@ -280,2 +291,19 @@ | ||
it('typeIn element should fire input on each character', function(){ | ||
var firedEvents = []; | ||
insertHtml('<input type="text" class="input">') | ||
.on('input', function(){ | ||
firedEvents.push('input'); | ||
}); | ||
return browser.find('.input').typeIn('123').then(function(){ | ||
expect(firedEvents).to.eql([ | ||
'input', | ||
'input', | ||
'input' | ||
]) | ||
}); | ||
}); | ||
it('typeIn element should fire change and then blur event on input', function(){ | ||
@@ -282,0 +310,0 @@ var firedEvents = []; |
54644
1153