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

  beforeEach(function () {
    this.setupComponent('<div id="userAlerts"></div>', { dismissTimeout: 100 });
  });

  it('should render message when ui:user_alerts:displayMessage is triggered', function () {
    this.component.trigger(Pixelated.events.ui.userAlerts.displayMessage, { message: 'a message' });

    expect(this.component.$node.html()).toEqual('<span class="message-panel__growl message-panel__growl--success">a message</span>\n');
  });

  it('should render error message', function () {
    this.component.trigger(Pixelated.events.ui.userAlerts.displayMessage, { message: 'send failed', class: 'error' });

    expect(this.component.$node.html()).toEqual('<span class="message-panel__growl message-panel__growl--error">send failed</span>\n');
  });

  it('should be emptied and hidden when hide is called', function() {
    expect(this.$node).not.toBeHidden();
    this.component.hide();
    expect(this.$node).toBeHidden();
    expect(this.$node.html()).toEqual('');
  });

});