summaryrefslogtreecommitdiffstats
path: root/doc/backends/deckjs/deck.js/test/spec.scale.js
blob: 02be2d87aaecc7312e3fb3281e8516deb90bcf38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
describe('Deck JS Status Indicator', function() {
  beforeEach(function() {
    loadFixtures('standard.html');
    if (Modernizr.history) {
      history.replaceState({}, "", "#")
    }
    else {
      window.location.hash = '#';
    }
    $.deck('.slide');
  });

  it('should start with scaling enabled', function() {
    expect($.deck('getContainer')).toHaveClass(defaults.classes.scale);
  });

  describe('disableScale()', function() {
    it('should remove the scale class from the container', function() {
      $.deck('disableScale');
      expect($.deck('getContainer')).not.toHaveClass(defaults.classes.scale);
    });
  });

  describe('enableScale()', function() {
    it('should add the scale class to the container', function() {
      $.deck('disableScale');
      $.deck('enableScale');
      expect($.deck('getContainer')).toHaveClass(defaults.classes.scale);
    });
  });

  describe('toggleScale()', function() {
    it('should toggle between adding and removing the scale class', function() {
      $.deck('toggleScale');
      expect($.deck('getContainer')).not.toHaveClass(defaults.classes.scale);
      $.deck('toggleScale');
      expect($.deck('getContainer')).toHaveClass(defaults.classes.scale);
    });
  });

  describe('key bindings', function() {
    var e;
    var $d = $(document);

    beforeEach(function() {
      e = jQuery.Event('keydown.deckscale');
    });

    it('should toggle scaling if the specified key is pressed', function() {
      e.which = 83; // s
      $d.trigger(e);
      expect($.deck('getContainer')).not.toHaveClass(defaults.classes.scale);
      $d.trigger(e);
      expect($.deck('getContainer')).toHaveClass(defaults.classes.scale);
    });
  });
});