Sha256: 4c4dd4cf2753d395a0981252de3ae44fc69598d676a32bdeaed0344e139c72d4

Contents?: true

Size: 1.96 KB

Versions: 9

Compression:

Stored size: 1.96 KB

Contents

describe('Deck JS Navigation Buttons', function() {
	beforeEach(function() {
		loadFixtures('standard.html');
		if (Modernizr.history) {
			history.replaceState({}, "", "#")
		}
		else {
			window.location.hash = '#';
		}
		$.deck('.slide');
	});
	
	it('should go to the next slide if next link is clicked', function() {
		$(defaults.selectors.nextLink).click();
		expect($.deck('getSlide')).toHaveClass('slide2');
	});
	
	it('should go to the previous slide if previous link is clicked', function() {
		$.deck('go', 2);
		$(defaults.selectors.previousLink).click();
		expect($.deck('getSlide')).toHaveClass('slide2');
	});
	
	it('should add the disabled class to the previous link if on first slide', function() {
		expect($(defaults.selectors.previousLink)).toHaveClass(defaults.classes.navDisabled);
		$(defaults.selectors.nextLink).click();
		expect($(defaults.selectors.previousLink)).not.toHaveClass(defaults.classes.navDisabled);
		$(defaults.selectors.previousLink).click();
		expect($(defaults.selectors.previousLink)).toHaveClass(defaults.classes.navDisabled);
	});
	
	it('should add the disabled class to the next link if on last slide', function() {
		expect($(defaults.selectors.nextLink)).not.toHaveClass(defaults.classes.navDisabled);
		$.deck('go', $.deck('getSlides').length - 1);
		expect($(defaults.selectors.nextLink)).toHaveClass(defaults.classes.navDisabled);
	});
	
	it('should not start disabled if deck initialized in the middle', function() {
		$.deck('go', 2);
		$.deck('.slide');
		expect($(defaults.selectors.previousLink)).not.toHaveClass(defaults.classes.navDisabled);
	});
	
	it('should update the links hrefs with real fragment ids', function() {
		expect($(defaults.selectors.previousLink)).toHaveAttr('href', '#');
		expect($(defaults.selectors.nextLink)).toHaveAttr('href', '#custom-id');
		$.deck('go', 2);
		expect($(defaults.selectors.previousLink)).toHaveAttr('href', '#custom-id');
		expect($(defaults.selectors.nextLink)).toHaveAttr('href', '#slide-3');
	});
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
deckrb-0.4.2 public/deck.js/test/spec.navigation.js
deckrb-0.4.1 public/deck.js/test/spec.navigation.js
deckrb-0.4.0 public/deck.js/test/spec.navigation.js
deckrb-0.3.1 public/deck.js/test/spec.navigation.js
deckrb-0.3.0 public/deck.js/test/spec.navigation.js
deckrb-0.2.2 public/deck.js/test/spec.navigation.js
deckrb-0.2.1 public/deck.js/test/spec.navigation.js
deckrb-0.2.0 public/deck.js/test/spec.navigation.js
deckrb-0.1.0 deck/test/spec.navigation.js