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

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="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="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('');
  });



});