(function($) { /* ======== A Handy Little QUnit Reference ======== http://api.qunitjs.com/ Test methods: QUnit.module(name, {[setup][ ,teardown]}) QUnit.test(name, callback) expect(numberOfAssertions) stop(increment) start(decrement) Test assertions: assert.ok(value, [message]) assert.equal(actual, expected, [message]) notEqual(actual, expected, [message]) deepEqual(actual, expected, [message]) notDeepEqual(actual, expected, [message]) strictEqual(actual, expected, [message]) notStrictEqual(actual, expected, [message]) throws(block, [expected], [message]) */ var tableHtml = [ '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '
HeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeader
Body Row 11This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.This column text is designed to make the columns really wide.
Body Row 22AAAAAAAAAAAAAAAAA
Body Row 1010AAAAAAAAAAAAAAAAA
body row 410AAAAAAAAAAAAAAAAA
Body Row 1.21.2AAAAAAAAAAAAAAAAA
'].join(''), $fixture, $table, setup = function( tableAttributes ) { return function() { $fixture = $( '#qunit-fixture' ); // We use columntoggle here to make the cell html comparisons easier (stack adds elements to each cell) $fixture.html( tableHtml.replace( /\%s/, tableAttributes ) ); // WAIT, do this in the tests. // $( document ).trigger( 'enhance.tablesaw' ); $table = $fixture.find( 'table' ); }; }; QUnit.module( 'tablesaw manual init', { beforeEach: setup( 'data-tablesaw-mode="stack"' ) }); QUnit.test( 'Initialization global', function( assert ) { assert.ok( !$fixture.find( 'table' ).is(".tablesaw-stack"), 'Does not have initialization class.' ); Tablesaw.init(); assert.ok( $fixture.find( 'table' ).is(".tablesaw-stack"), 'Does have initialization class.' ); }); QUnit.test( 'Initialization directly on the table', function( assert ) { assert.ok( !$fixture.find( 'table' ).is(".tablesaw-stack"), 'Does not have initialization class.' ); Tablesaw.init( $fixture.find( 'table' )[0]); assert.ok( $fixture.find( 'table' ).is(".tablesaw-stack"), 'Does have initialization class.' ); }); }( window.shoestring || window.jQuery || window.$jQ ));