diff options
author | Giovane <giovaneliberato@gmail.com> | 2015-09-14 14:44:47 -0300 |
---|---|---|
committer | Giovane <giovaneliberato@gmail.com> | 2015-09-14 15:55:37 -0300 |
commit | 424f135cf1c777399ff6659b7e5ba1d1f37593ea (patch) | |
tree | fc27aa6eb8a3513f7f7f84b2ccc727a6d820ecf3 | |
parent | b4bc06226f7b64a928d54483b77707022f068235 (diff) |
#442 trigger open event when click on feedback link.
-rw-r--r-- | web-ui/app/js/page/events.js | 3 | ||||
-rw-r--r-- | web-ui/app/js/page/feedback.js | 7 | ||||
-rw-r--r-- | web-ui/app/templates/page/feedback.hbs | 2 | ||||
-rw-r--r-- | web-ui/test/spec/page/feedback.spec.js | 17 |
4 files changed, 27 insertions, 2 deletions
diff --git a/web-ui/app/js/page/events.js b/web-ui/app/js/page/events.js index cf1b29ad..c00c2848 100644 --- a/web-ui/app/js/page/events.js +++ b/web-ui/app/js/page/events.js @@ -69,6 +69,9 @@ define(function () { next: 'ui:page:next', changed: 'ui:page:changed' }, + feedback: { + open: 'ui:feedback:open' + }, composeBox: { newMessage: 'ui:composeBox:newMessage', newReply: 'ui:composeBox:newReply', diff --git a/web-ui/app/js/page/feedback.js b/web-ui/app/js/page/feedback.js index 032aedbc..34af9b67 100644 --- a/web-ui/app/js/page/feedback.js +++ b/web-ui/app/js/page/feedback.js @@ -15,7 +15,7 @@ * along with Pixelated. If not, see <http://www.gnu.org/licenses/>. */ -define(['flight/lib/component', 'views/templates'], function (defineComponent, templates) { +define(['flight/lib/component', 'views/templates', 'page/events'], function (defineComponent, templates, events) { 'use strict'; return defineComponent(function () { @@ -23,8 +23,13 @@ define(['flight/lib/component', 'views/templates'], function (defineComponent, t this.$node.html(templates.page.feedback()); }; + this.onClick = function() { + this.trigger(document, events.ui.feedback.open); + } + this.after('initialize', function () { this.render(); + this.on('click', this.onClick); }); }); diff --git a/web-ui/app/templates/page/feedback.hbs b/web-ui/app/templates/page/feedback.hbs index 7c5c4d0c..72f9b94b 100644 --- a/web-ui/app/templates/page/feedback.hbs +++ b/web-ui/app/templates/page/feedback.hbs @@ -1,5 +1,5 @@ <ul id="feedback"> - <a title="feedback" href=""> + <a title="Feedback" href=""> <li> <div class="fa fa-exclamation-circle"></div> <i class="shortcut-label"></i> Feedback diff --git a/web-ui/test/spec/page/feedback.spec.js b/web-ui/test/spec/page/feedback.spec.js index e69de29b..1435a4b8 100644 --- a/web-ui/test/spec/page/feedback.spec.js +++ b/web-ui/test/spec/page/feedback.spec.js @@ -0,0 +1,17 @@ +describeComponent('page/feedback', function () { + 'use strict'; + + describe('feedback link', function () { + + it('should trigger ui:feedback:open event on click', function () { + + this.setupComponent('<nav id="feedback"></nav>', {}); + var spy = spyOnEvent(document, Pixelated.events.ui.feedback.open); + + this.$node.find('a').click(); + expect(spy).toHaveBeenTriggeredOn(document); + }); + + }); +}); + |