summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js
blob: f35218d008a32c9f866949b4171ed3e461d8280d (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
/*global Pixelated */

describeComponent('dispatchers/middle_pane_dispatcher', function () {
  'use strict';

  beforeEach(function() {
    setupComponent('<div><div id="middle-pane" style="height: 200px; overflow-y: scroll;"><div style="height: 400px"></div></div></div>');
  });

  it ('listens to refresh mail list event', function() {
    var mailsListRefreshEventSpy = spyOnEvent(document, Pixelated.events.ui.mails.fetchByTag);
    this.component.trigger(document, Pixelated.events.dispatchers.middlePane.refreshMailList);
    expect(mailsListRefreshEventSpy).toHaveBeenTriggeredOn(document);
  });

  it ('listens to unselect event', function() {
    var mailListUnselectEvent = spyOnEvent(document, Pixelated.events.ui.mails.cleanSelected);
    this.component.trigger(document, Pixelated.events.dispatchers.middlePane.cleanSelected);
    expect(mailListUnselectEvent).toHaveBeenTriggeredOn(document);
  });

  it('resets the scrollTop value when asked to', function() {
    this.component.select('middlePane').scrollTop(200);
    this.component.trigger(document, Pixelated.events.dispatchers.middlePane.resetScroll);
    expect(this.component.select('middlePane').scrollTop()).toEqual(0);
  });
});