diff options
author | Giovane <giovaneliberato@gmail.com> | 2015-09-16 18:39:24 -0300 |
---|---|---|
committer | Giovane <giovaneliberato@gmail.com> | 2015-09-16 18:39:30 -0300 |
commit | 1a7476f7a187f7eb65e358875a05c01869f54020 (patch) | |
tree | d8ae6f9fef9fe3933496ab23ba9818abfa93ce34 /web-ui | |
parent | 6d0f97b677704b8dc04aa70f32a85660df4f1822 (diff) |
#442 Add close behaviour to feedback box.
Diffstat (limited to 'web-ui')
-rw-r--r-- | web-ui/app/js/mail_view/ui/feedback_box.js | 9 | ||||
-rw-r--r-- | web-ui/test/spec/mail_view/ui/feedback_box.spec.js | 19 |
2 files changed, 28 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 1a06b8a3..4656a235 100644 --- a/web-ui/app/js/mail_view/ui/feedback_box.js +++ b/web-ui/app/js/mail_view/ui/feedback_box.js @@ -20,6 +20,10 @@ define(['flight/lib/component', 'views/templates', 'page/events', 'features'], 'use strict'; return defineComponent(function () { + this.defaultAttrs({ + 'closeButton': '.close-mail-button' + }); + this.render = function () { this.$node.html(templates.compose.feedback()); }; @@ -31,10 +35,15 @@ define(['flight/lib/component', 'views/templates', 'page/events', 'features'], this.enableFloatlabel('textarea.floatlabel'); }; + this.showNoMessageSelected = function() { + this.trigger(document, events.dispatchers.rightPane.openNoMessageSelected); + }; + this.after('initialize', function () { if (features.isEnabled('feedback')) { this.render(); this.on(document, events.dispatchers.rightPane.openFeedbackBox, this.openFeedbackBox); + this.on(this.select('closeButton'), 'click', this.showNoMessageSelected); } }); 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 new file mode 100644 index 00000000..cbe9b0bb --- /dev/null +++ b/web-ui/test/spec/mail_view/ui/feedback_box.spec.js @@ -0,0 +1,19 @@ +describeComponent('mail_view/ui/feedback_box', function () { + 'use strict'; + beforeEach(function () { + Pixelated.mockBloodhound(); + this.setupComponent('<div></div>'); + }); + + + describe('close button behavior', function() { + + it('should fire Show no message selected if the close button is clicked', function() { + var spy = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openNoMessageSelected); + this.component.select('closeButton').click(); + expect(spy).toHaveBeenTriggeredOn(document); + }); + + }); + +}); |