summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_list_actions/ui/mail_list_actions.spec.js
blob: 7f7ba64a948c123ec6ddb8863545d40b1073f74f (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
describeComponent('mail_list_actions/ui/mail_list_actions', function () {
  'use strict';
  var mailListActionsContainer;

  describe('post initialization', function () {
    beforeEach(function () {
      this.setupComponent();
      mailListActionsContainer = $('<input>', { id: 'delete-selected'});
    });

    it('should render button text', function () {
      $(document).trigger(Pixelated.events.ui.tag.select, {tag: 'inbox'});
      
      expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="Delete" disabled="disabled"></li>');
    });

    it('should render button text delete permanently if tag trash', function () {
      $(document).trigger(Pixelated.events.ui.tag.select, {tag: 'trash'});
      
      expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="Delete permanently" disabled="disabled"></li>');
    });
    
    it('should render button delete permanently if url contains trash tag', function () {
      var urlParams = require('page/router/url_params');
      spyOn(urlParams, 'getTag').and.returnValue('trash');

      this.setupComponent();

      expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="Delete permanently" disabled="disabled"></li>');
    });
  });
});