Mercurial > hg > Members > taiki > slides
diff deck.js/test/spec.status.js @ 0:dd1c78c6398f
add having slides
author | taiki <taiki@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Mar 2013 05:14:03 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deck.js/test/spec.status.js Mon Mar 25 05:14:03 2013 +0900 @@ -0,0 +1,58 @@ +describe('Deck JS Status Indicator', function() { + beforeEach(function() { + loadFixtures('standard.html'); + if (Modernizr.history) { + history.replaceState({}, "", "#") + } + else { + window.location.hash = '#'; + } + $.deck('.slide'); + }); + + it('should show the correct total number of slides', function() { + expect($(defaults.selectors.statusTotal)).toHaveText($.deck('getSlides').length); + }); + + it('should start at the right current slide', function() { + expect($(defaults.selectors.statusCurrent)).toHaveText(1); + $.deck('go', 2); + $.deck('.slide'); + expect($(defaults.selectors.statusCurrent)).toHaveText(3); + }); + + it('should update to the correct number on slide change', function() { + $.deck('go', 2); + expect($(defaults.selectors.statusCurrent)).toHaveText('3'); + }); +}); + +describe('countNested false indicator', function() { + beforeEach(function() { + loadFixtures('nesteds.html'); + if (Modernizr.history) { + history.replaceState({}, "", "#") + } + else { + window.location.hash = '#'; + } + $.deck('.slide', { + countNested: false + }); + }); + + it('should ignore nested slides in the total', function() { + expect($(defaults.selectors.statusTotal)).toHaveText('5'); + }); + + it('should update to the root slide number when nested becomes active', function() { + $.deck('go', 10); + expect($(defaults.selectors.statusCurrent)).toHaveText('4'); + $.deck('prev'); + expect($(defaults.selectors.statusCurrent)).toHaveText('3'); + $.deck('go', 3); + expect($(defaults.selectors.statusCurrent)).toHaveText('3'); + $.deck('go', 1); + expect($(defaults.selectors.statusCurrent)).toHaveText('2'); + }); +}); \ No newline at end of file