siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
40 lines (30 loc) • 1.01 kB
JavaScript
describe('Should navigate to previous page on BACKSPACE key', function (t) {
// Safari / Chrome / Firefox doesn't navigate on BACKSPACE
if (t.browser.webkit || t.browser.blink || t.browser.firefox) return;
t.chain(
{ setUrl : 'basic2.html' },
{
waitFor : function () {
return t.global.location.href.match('basic2.html');
}
},
{ click : '.bar' },
{ waitFor : 500 },
{ type : '[BACKSPACE]', target : 'body' },
{
waitFor : function () {
return t.global.location.href.match('basic1.html');
}
},
{ waitFor : 500 },
{ type : '[BACKSPACE]', target : 'body', options : { shiftKey : true } },
{
waitFor : function () {
return t.global.location.href.match('basic2.html');
}
},
function(next) {
t.like(t.global.location.href, 'basic2.html')
}
)
});