siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
44 lines (30 loc) • 1.08 kB
JavaScript
StartTest(function(t) {
// cloud providers do not support native events
if (t.simulator.type != 'native') return
t.it('Should trigger :hover styles', function (t) {
t.chain(
{ moveMouseTo : '#hover', offset : [ '10%', '50%' ] },
function () {
var el = document.getElementById('hover')
t.is(getComputedStyle(el).color, 'rgb(255, 0, 0)')
}
)
})
t.it('Should select text with mouse', function (t) {
t.chain(
{ type : 'some long text', target : '#input' },
{ drag : '#input', offset : [ '80%', '50%' ], to : '#input', toOffset : [ '1%', '50%' ] },
function () {
t.is(t.getSelectedText('#input'), 'some long text')
}
)
})
t.it('Should select text with mouse #2', function (t) {
t.chain(
{ doubleclick : '#input2', offset : [ '10%', '50%' ] },
function () {
t.is(t.getSelectedText('#input2'), 'quix')
}
)
})
})