switched tests to qunit
This commit is contained in:
parent
b3aff50d6a
commit
c78bc6cef5
8 changed files with 2568 additions and 3 deletions
53
lib/tests/unit/ComicBook.js
Normal file
53
lib/tests/unit/ComicBook.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* global $: false, module: false, test: false, equal: false, ComicBook: false console: false */
|
||||
|
||||
$(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var $fixture;
|
||||
var book;
|
||||
|
||||
module('ComicBook', {
|
||||
|
||||
setup: function () {
|
||||
|
||||
$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/' }
|
||||
);
|
||||
|
||||
// book.draw();
|
||||
},
|
||||
|
||||
teardown: function () {
|
||||
}
|
||||
});
|
||||
|
||||
test('render all controls on draw', 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');
|
||||
});
|
||||
|
||||
// navigate on keyboard
|
||||
// don't navigate if nothing left
|
||||
// show current page
|
||||
// customise keyboard control
|
||||
// dropdown menus
|
||||
// apply effects
|
||||
// maximise
|
||||
// minimise
|
||||
// fit width
|
||||
// single page / double page
|
||||
// single page should allow double page spreads
|
||||
// preloading
|
||||
// update hash
|
||||
// resume based on hash
|
||||
// load from middle of page
|
||||
// emit custom events based on data-attributes
|
||||
// destroy
|
||||
});
|
24
lib/tests/unit/logger.js
Normal file
24
lib/tests/unit/logger.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* jshint strict: false */
|
||||
/* global console: false, QUnit: false */
|
||||
|
||||
// Logging setup for phantom integration
|
||||
// Taken from Twitter Bootstrap
|
||||
|
||||
QUnit.begin = function () {
|
||||
console.log('Starting test suite');
|
||||
console.log('================================================\n');
|
||||
};
|
||||
|
||||
QUnit.moduleDone = function (opts) {
|
||||
if (opts.failed === 0) {
|
||||
console.log('\u2714 All tests passed in "' + opts.name + '" module');
|
||||
} else {
|
||||
console.log('\u2716 ' + opts.failed + ' tests failed in "' + opts.name + '" module');
|
||||
}
|
||||
};
|
||||
|
||||
QUnit.done = function (opts) {
|
||||
console.log('\n================================================');
|
||||
console.log('Tests completed in ' + opts.runtime + ' milliseconds');
|
||||
console.log(opts.passed + ' tests of ' + opts.total + ' passed, ' + opts.failed + ' failed.');
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue