siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
29 lines (23 loc) • 938 B
JavaScript
StartTest({
viewportWidth : 800,
viewportHeight : 600
}, function (t) {
t.it('Should fire `mouseover` action after the `scrollTo`', function (t) {
document.body.innerHTML =
'<div id="scrollDiv" style="height: 500px; width: 500px; overflow: scroll">' +
'Some text<br><br><br><br><br>' +
'<div id="tallDiv" style="height:1000px;background:red">tall div</div>' +
'</div>'
t.chain(
{ moveCursorTo : '#scrollDiv', offset : [ '50%', 25 ] },
function (next) {
t.firesOnce('#tallDiv', 'mouseover')
next()
},
// `mouseover` should be triggered by the scroll itself with native
{ scrollTo : [ '#scrollDiv', 0, 150 ] },
// `mouseover` should be triggered by this move with synthetic
{ moveCursorBy : [ 1, 1 ] }
)
});
});