diff options
-rw-r--r-- | web-ui/app/js/mail_view/ui/feedback_box.js | 5 | ||||
-rw-r--r-- | web-ui/app/js/page/default.js | 3 | ||||
-rw-r--r-- | web-ui/test/spec/mail_view/ui/feedback_box.spec.js | 8 |
3 files changed, 16 insertions, 0 deletions
diff --git a/web-ui/app/js/mail_view/ui/feedback_box.js b/web-ui/app/js/mail_view/ui/feedback_box.js index aad35f2a..eb079b5b 100644 --- a/web-ui/app/js/mail_view/ui/feedback_box.js +++ b/web-ui/app/js/mail_view/ui/feedback_box.js @@ -46,11 +46,16 @@ define(['flight/lib/component', 'views/templates', 'page/events', 'features'], this.trigger(document, events.feedback.submit, { feedback: feedback }); }; + this.showSuccessMessage = function () { + this.trigger(document, events.ui.userAlerts.displayMessage, { message: 'Thanks for your feedback!' }); + }; + this.after('initialize', function () { if (features.isEnabled('feedback')) { this.render(); this.on(document, events.dispatchers.rightPane.openFeedbackBox, this.openFeedbackBox); this.on(document, events.feedback.submitted, this.showNoMessageSelected); + this.on(document, events.feedback.submitted, this.showSuccessMessage); this.on(this.select('closeButton'), 'click', this.showNoMessageSelected); this.on(this.select('submitButton'), 'click', this.submitFeedback); } diff --git a/web-ui/app/js/page/default.js b/web-ui/app/js/page/default.js index 37eabaec..1189d1ad 100644 --- a/web-ui/app/js/page/default.js +++ b/web-ui/app/js/page/default.js @@ -45,6 +45,7 @@ define( 'page/logout_shortcut', 'feedback/feedback_trigger', 'mail_view/ui/feedback_box', + 'mail_view/data/feedback_sender', 'page/version', ], @@ -78,6 +79,7 @@ define( logoutShortcut, feedback, feedbackBox, + feedbackSender, version) { 'use strict'; @@ -114,6 +116,7 @@ define( version.attachTo('.version'); feedback.attachTo('#feedback'); + feedbackSender.attachTo(document); } return initialize; diff --git a/web-ui/test/spec/mail_view/ui/feedback_box.spec.js b/web-ui/test/spec/mail_view/ui/feedback_box.spec.js index f0d55791..4702672c 100644 --- a/web-ui/test/spec/mail_view/ui/feedback_box.spec.js +++ b/web-ui/test/spec/mail_view/ui/feedback_box.spec.js @@ -32,6 +32,14 @@ describeComponent('mail_view/ui/feedback_box', function () { this.component.trigger(document, Pixelated.events.feedback.submitted); expect(spy).toHaveBeenTriggeredOn(document); }); + + it('should shows success message after submit', function () { + var spy = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage); + + this.component.trigger(document, Pixelated.events.feedback.submitted); + expect(spy).toHaveBeenTriggeredOnAndWith(document, {message: 'Thanks for your feedback!'}); + }); + }); }); |