siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
43 lines (32 loc) • 1.28 kB
JavaScript
StartTest(function (t) {
t.expectGlobal('0');
t.beforeEach(function () {
document.body.innerHTML = '';
})
t.it('Basic DOM query', function (t) {
document.body.innerHTML = '<div></div><div></div>';
t.isDeeply(t.query('body'), [document.body]);
t.is(t.query('div').length, 2);
})
t.it('Ext JS Component', function (t) {
var panel = new Ext.Panel({
title : 'foo',
html : '<header class="foo"></header>',
renderTo : document.body
})
t.isDeeply(t.query('>>panel[title=foo]'), [panel.el.dom]);
t.isDeeply(t.query('panel => header.foo'), [document.body.querySelector('header.foo')]);
})
t.it('Ext JS Component in iframe', function (t) {
document.body.innerHTML = '<iframe height="400" width="700" class="theframe" src="./" />'
t.chain(
// Nested CQ
{ waitForSelector : '.theframe -> >>testgrid '},
// Nested Composite Query
{ click : '.theframe -> testgrid => .fa-close '},
{ doubleClick : '.theframe -> testgrid => .x-grid-cell:contains(010_sanity) '},
// Extra nested
{ waitForSelector : '.theframe -> .tr-iframe -> body '}
)
})
})