summaryrefslogtreecommitdiff
path: root/web-ui/test
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/test')
-rw-r--r--web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js15
-rw-r--r--web-ui/test/spec/user_alerts/ui/user_alerts.spec.js8
2 files changed, 22 insertions, 1 deletions
diff --git a/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js b/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js
index 5e65ddbb..20deeae3 100644
--- a/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js
+++ b/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js
@@ -13,4 +13,19 @@ describeComponent('mail_list_actions/ui/compose_trigger', function () {
expect(spyEvent).toHaveBeenTriggeredOn(document);
});
+ it('trigger showEmailSuccess message when message is sent', function () {
+ var spyEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
+
+ this.component.trigger(document, Pixelated.events.mail.sent);
+
+ expect(spyEvent).toHaveBeenTriggeredOnAndWith(document, {message: 'Your message was sent!', class: 'success'});
+ });
+
+ it('trigger showEmailError message when message is not sent', function () {
+ var spyEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
+
+ this.component.trigger(document, Pixelated.events.mail.send_failed, {responseJSON: {message: 'failure'}});
+
+ expect(spyEvent).toHaveBeenTriggeredOnAndWith(document, {message: 'Error, message not sent: failure', class: 'error'});
+ });
});
diff --git a/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js b/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
index 5b25b5fb..5d87795a 100644
--- a/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
+++ b/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
@@ -10,7 +10,13 @@ describeComponent('user_alerts/ui/user_alerts', function () {
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()).toMatch('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() {