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,9 +7,7 @@ $(function () {
var $fixture; var $fixture;
var book; var book;
module('ComicBook', { function initBook() {
setup: function () {
$fixture = $('#qunit-fixture'); $fixture = $('#qunit-fixture');
$fixture.append('<canvas id="comic"></canvas>'); $fixture.append('<canvas id="comic"></canvas>');
@ -19,17 +17,28 @@ $(function () {
['img/1.png','img/2.png','img/3.png','img/4.png','img/5.png','img/6.png'], ['img/1.png','img/2.png','img/3.png','img/4.png','img/5.png','img/6.png'],
{ libPath: '../vendor/' } { libPath: '../vendor/' }
); );
}
// book.draw(); 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 () {
initBook();
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');
}); });