summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/page/pane_contract_expand.spec.js
blob: 61d786ebf471fd1e5f8587929a5356c7f43be54d (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
58
59
60
61
62
63
64
65
66
67
/*global Pixelated */
/*global afterEach */

'use strict';

describeComponent('page/pane_contract_expand', function () {

  var fixture;

  beforeEach(function () {
    fixture = $('<div>')
      .append($('<div>', { id: 'middle-pane-container' }))
      .append($('<div>', { id: 'right-pane' }));

    $('body').append(fixture);


  });

  afterEach(function () {
    fixture.remove();
  });

  describe('after initialization', function () {
    beforeEach(function () {
      this.setupComponent(document);
    });

    it('contracts middle pane and expands right pane on mail open', function () {
      $(document).trigger(Pixelated.events.ui.mail.open);

      expect($('#middle-pane-container').attr('class')).toEqual(this.component.attr.MIDDLE_PANE_CONTRACT_CLASSES);
      expect($('#right-pane').attr('class')).toEqual(this.component.attr.RIGHT_PANE_EXPAND_CLASSES);
    });

    it('contracts middle pane and expands right pane on open compose box', function () {
      $(document).trigger(Pixelated.events.dispatchers.rightPane.openComposeBox);

      expect($('#middle-pane-container').attr('class')).toEqual(this.component.attr.MIDDLE_PANE_CONTRACT_CLASSES);
      expect($('#right-pane').attr('class')).toEqual(this.component.attr.RIGHT_PANE_EXPAND_CLASSES);
    });

    it('contracts middle pane and expands right pane on open draft', function () {
      $(document).trigger(Pixelated.events.dispatchers.rightPane.openDraft);

      expect($('#middle-pane-container').attr('class')).toEqual(this.component.attr.MIDDLE_PANE_CONTRACT_CLASSES);
      expect($('#right-pane').attr('class')).toEqual(this.component.attr.RIGHT_PANE_EXPAND_CLASSES);
    });

    it('expands middle pane and contracts right pane on event on open no message selected pane', function () {
      $(document).trigger(Pixelated.events.dispatchers.rightPane.openNoMessageSelected);

      expect($('#middle-pane-container').attr('class')).toEqual(this.component.attr.MIDDLE_PANE_EXPAND_CLASSES);
      expect($('#right-pane').attr('class')).toEqual(this.component.attr.RIGHT_PANE_CONTRACT_CLASSES);
    });
  });

  describe('on initialization', function () {
    it('expands middle pane and contracts right pane', function () {
      this.setupComponent(document);

      expect($('#middle-pane-container').attr('class')).toEqual(this.component.attr.MIDDLE_PANE_EXPAND_CLASSES);
      expect($('#right-pane').attr('class')).toEqual(this.component.attr.RIGHT_PANE_CONTRACT_CLASSES);
    });
  });

});