Commit | Line | Data |
---|---|---|
d0f6c3cd AE |
1 | describe('Deck JS Status Indicator', function() { |
2 | beforeEach(function() { | |
3 | loadFixtures('standard.html'); | |
4 | if (Modernizr.history) { | |
5 | history.replaceState({}, "", "#") | |
6 | } | |
7 | else { | |
8 | window.location.hash = '#'; | |
9 | } | |
10 | $.deck('.slide'); | |
11 | }); | |
12 | ||
13 | it('should show the correct total number of slides', function() { | |
14 | expect($(defaults.selectors.statusTotal)).toHaveText($.deck('getSlides').length); | |
15 | }); | |
16 | ||
17 | it('should start at the right current slide', function() { | |
18 | expect($(defaults.selectors.statusCurrent)).toHaveText(1); | |
19 | $.deck('go', 2); | |
20 | $.deck('.slide'); | |
21 | waitsFor(function() { | |
22 | return $(defaults.selectors.statusCurrent).text() === '3'; | |
23 | }); | |
24 | }); | |
25 | ||
26 | it('should update to the correct number on slide change', function() { | |
27 | $.deck('go', 2); | |
28 | expect($(defaults.selectors.statusCurrent)).toHaveText('3'); | |
29 | }); | |
30 | }); | |
31 | ||
32 | describe('countNested false indicator', function() { | |
33 | beforeEach(function() { | |
34 | loadFixtures('nesteds.html'); | |
35 | if (Modernizr.history) { | |
36 | history.replaceState({}, "", "#") | |
37 | } | |
38 | else { | |
39 | window.location.hash = '#'; | |
40 | } | |
41 | $.deck('.slide', { | |
42 | countNested: false | |
43 | }); | |
44 | }); | |
45 | ||
46 | it('should ignore nested slides in the total', function() { | |
47 | expect($(defaults.selectors.statusTotal)).toHaveText('5'); | |
48 | }); | |
49 | ||
50 | it('should update to the root slide number when nested becomes active', function() { | |
51 | $.deck('go', 10); | |
52 | expect($(defaults.selectors.statusCurrent)).toHaveText('4'); | |
53 | $.deck('prev'); | |
54 | expect($(defaults.selectors.statusCurrent)).toHaveText('3'); | |
55 | $.deck('go', 3); | |
56 | expect($(defaults.selectors.statusCurrent)).toHaveText('3'); | |
57 | $.deck('go', 1); | |
58 | expect($(defaults.selectors.statusCurrent)).toHaveText('2'); | |
59 | }); | |
60 | }); |