1 describe('Deck JS Menu', function() {
3 var dsc = defaults.selectors.container;
5 beforeEach(function() {
6 loadFixtures('standard.html');
7 if (Modernizr.history) {
8 history.replaceState({}, "", "#")
11 window.location.hash = '#';
16 describe('showMenu()', function() {
17 it('should show the menu', function() {
18 expect($(dsc)).not.toHaveClass(defaults.classes.menu);
20 expect($(dsc)).toHaveClass(defaults.classes.menu);
23 it('should do nothing if menu is already showing', function() {
24 if (Modernizr.csstransforms) {
28 expect($('.slide').attr('style')).toBeFalsy();
33 describe('hideMenu()', function() {
34 it('should hide the menu', function() {
37 expect($(dsc)).not.toHaveClass(defaults.classes.menu);
41 describe('toggleMenu()', function() {
42 it('should toggle menu on and off', function() {
43 expect($(dsc)).not.toHaveClass(defaults.classes.menu);
45 expect($(dsc)).toHaveClass(defaults.classes.menu);
47 expect($(dsc)).not.toHaveClass(defaults.classes.menu);
51 describe('key bindings', function() {
54 beforeEach(function() {
55 e = jQuery.Event('keydown.deckmenu');
58 it('should toggle the menu if the specified key is pressed', function() {
61 expect($(dsc)).toHaveClass(defaults.classes.menu);
63 expect($(dsc)).not.toHaveClass(defaults.classes.menu);
67 describe('touch bindings', function() {
70 beforeEach(function() {
71 estart = jQuery.Event('touchstart.deckmenu');
72 eend = jQuery.Event('touchend.deckmenu');
75 it('should toggle the menu if the screen is touched', function() {
76 $.deck('getOptions').touch.doubletapWindow = Date.now() + 100000;
77 $.deck('getContainer').trigger(estart);
78 $.deck('getContainer').trigger(eend);
79 expect($(dsc)).toHaveClass(defaults.classes.menu);