UNPKG

siesta-lite

Version:

Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers

67 lines (49 loc) 1.52 kB
StartTest(function (t) { var field t.beforeEach(function () { field && field.destroy(); }) t.it('Should clear selected text in input on DELETE', function (t) { field = new Ext.form.TextField({ renderTo : document.body, value : 'foo' }); field.selectText() t.chain( { type : '[DELETE]', target : field }, function (next) { t.is(field.inputEl.dom.value, "") t.is(field.getValue(), "") } ) }); t.it('Should clear selected text in input on BACKSPACE', function (t) { field = new Ext.form.TextField({ renderTo : document.body, value : 'foo' }); field.selectText() t.chain( { type : '[BACKSPACE]', target : field }, function (next) { t.is(field.inputEl.dom.value, "") t.is(field.getValue(), "") } ) }); t.it('Should replace selected text when typing in input', function (t) { field = new Ext.form.TextField({ renderTo : document.body, value : 'foo' }); field.selectText() field.setValue('foo foo bar') t.chain( { selectText : [field.inputEl.dom, 4, 7]}, { type : 'new', target : field }, function (next) { t.is(field.getValue(), "foo new bar") } ) }); });