split tests into modules

This commit is contained in:
Bala Clark 2013-05-10 00:03:53 +02:00
parent c78bc6cef5
commit 185b830daf

View file

@ -7,29 +7,38 @@ $(function () {
var $fixture; var $fixture;
var book; var book;
module('ComicBook', { function initBook() {
$fixture = $('#qunit-fixture');
$fixture.append('<canvas id="comic"></canvas>');
book = new ComicBook(
'comic',
['img/1.png','img/2.png','img/3.png','img/4.png','img/5.png','img/6.png'],
{ libPath: '../vendor/' }
);
}
module('not yet rendered comic', {
setup: initBook
});
test('controls shouldn\'t be renderd yet', function () {
equal($('.cb-control, .toolbar').length, 0, 'book not drawn yet, nothing should be rendered');
});
module('rendered comic', {
setup: function () { setup: function () {
initBook();
$fixture = $('#qunit-fixture'); book.draw();
$fixture.append('<canvas id="comic"></canvas>');
book = new ComicBook(
'comic',
['img/1.png','img/2.png','img/3.png','img/4.png','img/5.png','img/6.png'],
{ libPath: '../vendor/' }
);
// book.draw();
}, },
teardown: function () { teardown: function () {
} }
}); });
test('render all controls on draw', function () { test('all controls should be rendered', function () {
equal($('.cb-control, .toolbar').length, 0, 'book not drawn yet, nothing should be rendered');
book.draw();
equal($('.cb-control, .toolbar').length, 5, 'All toolbar elements should have rendered after book.draw'); equal($('.cb-control, .toolbar').length, 5, 'All toolbar elements should have rendered after book.draw');
}); });