diff options
Diffstat (limited to 'web-ui/test/spec/mail_view/ui/mail_actions.spec.js')
-rw-r--r-- | web-ui/test/spec/mail_view/ui/mail_actions.spec.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/web-ui/test/spec/mail_view/ui/mail_actions.spec.js b/web-ui/test/spec/mail_view/ui/mail_actions.spec.js new file mode 100644 index 00000000..93db0193 --- /dev/null +++ b/web-ui/test/spec/mail_view/ui/mail_actions.spec.js @@ -0,0 +1,63 @@ +/*global Smail */ + +describeComponent('mail_view/ui/mail_actions', function () { + 'use strict'; + + var testData; + + beforeEach(function(){ + testData = Smail.testData(); + setupComponent(testData); + }); + + it('verifies if more actions list is hidden when rendering mail view', function() { + + var moreActionsComponent = this.component.select('moreActions'); + expect(moreActionsComponent.attr('style').trim()).toEqual('display: none;'); + + }); + + it('show more actions list when click on view more actions button', function(){ + + this.component.select('viewMoreActions').click(); + + var moreActionsComponent = this.component.select('moreActions'); + expect(moreActionsComponent.attr('style').trim()).not.toEqual('display: none;'); + }); + + it('triggers a show reply box event when clicking on reply-button-top', function(){ + + var showReplyBoxEvent = spyOnEvent(document, Smail.events.ui.replyBox.showReply); + + this.component.select('replyButtonTop').click(); + + expect(showReplyBoxEvent).toHaveBeenTriggeredOn(document); + }); + + it('triggers a show reply all box event when clicking on reply-button-top and hide more actions list', function(){ + + var showReplyAllEvent = spyOnEvent(document, Smail.events.ui.replyBox.showReplyAll); + + this.component.select('viewMoreActions').click(); + this.component.select('replyAllButtonTop').click(); + + expect(showReplyAllEvent).toHaveBeenTriggeredOn(document); + + var moreActionsComponent = this.component.select('moreActions'); + expect(moreActionsComponent.attr('style').trim()).toEqual('display: none;'); + }); + + it('triggers a delete event when clicking on delete-button-top', function(){ + + var deleteEvent = spyOnEvent(document, Smail.events.ui.mail.delete); + + this.component.select('viewMoreActions').click(); + this.component.select('deleteButtonTop').click(); + + expect(deleteEvent).toHaveBeenTriggeredOnAndWith(document, {mail: testData.mail}); + + var moreActionsComponent = this.component.select('moreActions'); + expect(moreActionsComponent.attr('style').trim()).toEqual('display: none;'); + }); + +}); |