1 describe('Deck JS Navigation Buttons', function() {
2 beforeEach(function() {
3 loadFixtures('standard.html');
4 if (Modernizr
.history
) {
5 history
.replaceState({}, "", "#")
8 window
.location
.hash
= '#';
13 it('should go to the next slide if next link is clicked', function() {
14 $(defaults
.selectors
.nextLink
).click();
15 expect($.deck('getSlide')).toHaveClass('slide2');
18 it('should go to the previous slide if previous link is clicked', function() {
20 $(defaults
.selectors
.previousLink
).click();
21 expect($.deck('getSlide')).toHaveClass('slide2');
24 it('should add the disabled class to the previous link if on first slide', function() {
25 expect($(defaults
.selectors
.previousLink
)).toHaveClass(defaults
.classes
.navDisabled
);
26 $(defaults
.selectors
.nextLink
).click();
27 expect($(defaults
.selectors
.previousLink
)).not
.toHaveClass(defaults
.classes
.navDisabled
);
28 $(defaults
.selectors
.previousLink
).click();
29 expect($(defaults
.selectors
.previousLink
)).toHaveClass(defaults
.classes
.navDisabled
);
32 it('should add the disabled class to the next link if on last slide', function() {
33 expect($(defaults
.selectors
.nextLink
)).not
.toHaveClass(defaults
.classes
.navDisabled
);
34 $.deck('go', $.deck('getSlides').length
- 1);
35 expect($(defaults
.selectors
.nextLink
)).toHaveClass(defaults
.classes
.navDisabled
);
38 it('should not start disabled if deck initialized in the middle', function() {
41 expect($(defaults
.selectors
.previousLink
)).not
.toHaveClass(defaults
.classes
.navDisabled
);
44 it('should update the links hrefs with real fragment ids', function() {
45 expect($(defaults
.selectors
.previousLink
)).toHaveAttr('href', '#');
46 expect($(defaults
.selectors
.nextLink
)).toHaveAttr('href', '#custom-id');
48 expect($(defaults
.selectors
.previousLink
)).toHaveAttr('href', '#custom-id');
49 expect($(defaults
.selectors
.nextLink
)).toHaveAttr('href', '#slide-3');