From a1ac3eb200b8eb9eea764fe4ea761c9c6b319c7e Mon Sep 17 00:00:00 2001 From: Lisa Junger Date: Tue, 28 Oct 2014 16:01:17 +0100 Subject: disables send button when triggered. --- web-ui/app/js/mail_view/ui/send_button.js | 3 +++ web-ui/test/spec/mail_view/ui/send_button.spec.js | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'web-ui') diff --git a/web-ui/app/js/mail_view/ui/send_button.js b/web-ui/app/js/mail_view/ui/send_button.js index a9852367..5e3986f3 100644 --- a/web-ui/app/js/mail_view/ui/send_button.js +++ b/web-ui/app/js/mail_view/ui/send_button.js @@ -78,6 +78,9 @@ define([ }.bind(this))); this.trigger(document, events.ui.recipients.doCompleteInput); + this.disableButton(); + this.$node.text('Sending...'); + }; this.after('initialize', function () { diff --git a/web-ui/test/spec/mail_view/ui/send_button.spec.js b/web-ui/test/spec/mail_view/ui/send_button.spec.js index e97165f1..81e47803 100644 --- a/web-ui/test/spec/mail_view/ui/send_button.spec.js +++ b/web-ui/test/spec/mail_view/ui/send_button.spec.js @@ -6,7 +6,7 @@ describeComponent('mail_view/ui/send_button', function () { describe('send button', function () { beforeEach(function () { - this.setupComponent(''); }); describe('when it is disabled', function () { @@ -74,6 +74,15 @@ describeComponent('mail_view/ui/send_button', function () { expect(doCompleteInputEvent).toHaveBeenTriggeredOn(document); }); + + it('disables the button after clicking', function () { + expect(this.$node.text()).toBe('Send'); + + this.$node.click(); + + expect(this.$node.text()).toBe('Sending...'); + expect(this.$node.prop('disabled')).toBeTruthy(); + }); }); describe('after clicking', function () { -- cgit v1.2.3