/* 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
});

@@ -159,42 +159,8 @@
 ;%0A%0A 
- module('ComicBook', %7B%0A%0A    setup:
  fun
@@ -165,24 +165,30 @@
 unction 
+initBook
 () %7B%0A%0A
-  
     $fix
@@ -219,18 +219,16 @@
 ');%0A    
- 
- 
 $fixture
@@ -273,18 +273,16 @@
 );%0A%0A    
-  
 book = n
@@ -301,18 +301,16 @@
 (%0A      
-  
 'comic',
@@ -316,18 +316,16 @@
 ,%0A      
- 
- 
 %5B'img/1.
@@ -397,18 +397,16 @@
 ,%0A      
-  
 %7B libPat
@@ -431,120 +431,122 @@
     
-  
 );%0A
-%0A
   
-    // book.draw();%0A    %7D,%0A%0A    teardown: function () %7B%0A    %7D%0A  %7D);%0A%0A  test('render all controls on draw
+%7D%0A%0A  module('not yet rendered comic', %7B%0A    setup: initBook%0A  %7D);%0A%0A  test('controls shouldn%5C't be renderd yet
 ', f
@@ -663,22 +663,209 @@
 ;%0A  
-  book.draw();
+%7D);%0A%0A  module('rendered comic', %7B%0A%0A    setup: function () %7B%0A      initBook();%0A      book.draw();%0A    %7D,%0A%0A    teardown: function () %7B%0A    %7D%0A  %7D);%0A%0A  test('all controls should be rendered', function () %7B
 %0A   

split tests into modules