siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
45 lines (35 loc) • 1.47 kB
JavaScript
StartTest(function(t) {
t.testExtJS(function (t) {
t.it('Should be possible to press CTRL and SHIFT when typing', function(t) {
document.body.innerHTML = '<input id="txt" type="text">';
function doAssert(e) {
if (String.fromCharCode(e.getCharCode()) == 'Z') {
t.ok(e.ctrlKey, e.type + ': Ctrl key detected');
t.ok(e.shiftKey, e.type + ': Shift key detected');
}
}
Ext.get('txt').on({
keydown : doAssert,
keyup : doAssert
})
t.chain(
{
type : 'z',
target : '#txt',
options : { shiftKey : true, ctrlKey : true }
}
)
})
t.it('Should be possible to clear existing value when typing', function(t) {
document.body.innerHTML = '<input id="txt2" type="text" value="bar"><input id="txt3" type="text" value="bar">';
t.chain(
{ type : 'foo', target : '#txt2', clearExisting : true },
{ type : '', target : '#txt3', clearExisting : true },
function() {
t.expect(document.getElementById('txt2').value).toBe('foo');
t.expect(document.getElementById('txt3').value).toBe('');
}
);
});
});
});