diff options
Diffstat (limited to 'web-ui/test/spec')
4 files changed, 24 insertions, 16 deletions
diff --git a/web-ui/test/spec/mail_list/ui/mail_list.spec.js b/web-ui/test/spec/mail_list/ui/mail_list.spec.js index 22a10a31..3e6c8344 100644 --- a/web-ui/test/spec/mail_list/ui/mail_list.spec.js +++ b/web-ui/test/spec/mail_list/ui/mail_list.spec.js @@ -152,7 +152,7 @@ describeComponent('mail_list/ui/mail_list', function () { it('resets scroll when opening a new tag or choosing a new tag', function () { var eventSpy = spyOnEvent(document, Pixelated.events.dispatchers.middlePane.resetScroll); - this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList }); + this.component.$node.trigger(Pixelated.events.ui.tag.select, { mails: mailList }); expect(eventSpy).toHaveBeenTriggeredOn(document); }); diff --git a/web-ui/test/spec/mail_view/ui/mail_view.spec.js b/web-ui/test/spec/mail_view/ui/mail_view.spec.js index 86b40591..deb7fb88 100644 --- a/web-ui/test/spec/mail_view/ui/mail_view.spec.js +++ b/web-ui/test/spec/mail_view/ui/mail_view.spec.js @@ -117,7 +117,7 @@ describeComponent('mail_view/ui/mail_view', function () { it('assumes that the mail is encrypted and failure if all the locks are failed', function() { var email = testData; email.security_casing = {locks: [{state: 'failure'}, {state: 'failure'}]}; - expect(this.component.checkEncrypted(email)).toEqual('encrypted encryption-failure'); + expect(this.component.checkEncrypted(email)).toEqual('encrypted encryption-error'); }); it('assumes that the mail is not encrypted if it doesn\'t have any locks', function() { diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js index 70ae9301..24d57953 100644 --- a/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js +++ b/web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js @@ -105,22 +105,22 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () { }); describe('on keyup', function () { - it('triggers inputHasNoMail if input is empty', function () { - var inputHasNoMailEvent = spyOnEvent(document, Pixelated.events.ui.recipients.inputHasNoMail); + it('triggers inputFieldIsEmpty if input is empty', function () { + var inputFieldIsEmptyEvent = spyOnEvent(document, Pixelated.events.ui.recipients.inputFieldIsEmpty); this.$node.val(''); this.$node.trigger('keyup'); - expect(inputHasNoMailEvent).toHaveBeenTriggeredOn(document); + expect(inputFieldIsEmptyEvent).toHaveBeenTriggeredOn(document); }); - it('triggers inputHasMail if input is not empty', function () { - var inputHasMailEvent = spyOnEvent(document, Pixelated.events.ui.recipients.inputHasMail); + it('triggers inputFieldHasCharacters if input is not empty', function () { + var inputFieldHasCharactersEvent = spyOnEvent(document, Pixelated.events.ui.recipients.inputFieldHasCharacters); this.$node.val('lalala'); this.$node.trigger('keyup'); - expect(inputHasMailEvent).toHaveBeenTriggeredOn(document, { name: 'to' }); + expect(inputFieldHasCharactersEvent).toHaveBeenTriggeredOn(document, { name: 'to' }); }); }); 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 4109e923..ff1eecde 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 @@ -14,8 +14,8 @@ describeComponent('mail_view/ui/send_button', function () { this.$node.prop('disabled', true); }); - it('gets enabled in a inputHasMail event', function () { - $(document).trigger(Pixelated.events.ui.recipients.inputHasMail, { name: 'to' }); + it('gets enabled in a inputFieldHasCharacters event', function () { + $(document).trigger(Pixelated.events.ui.recipients.inputFieldHasCharacters, { name: 'to' }); expect(this.$node).not.toBeDisabled(); }); @@ -28,20 +28,20 @@ describeComponent('mail_view/ui/send_button', function () { }); describe('multiple events', function () { - it('gets enabled and remains enabled when a inputHasMail is followed by a recipients:updated with NO new recipients', function () { + it('gets enabled and remains enabled when a inputFieldHasCharacters is followed by a recipients:updated with NO new recipients', function () { this.$node.prop('disabled', true); - $(document).trigger(Pixelated.events.ui.recipients.inputHasMail, { name: 'to' }); + $(document).trigger(Pixelated.events.ui.recipients.inputFieldHasCharacters, { name: 'to' }); $(document).trigger(Pixelated.events.ui.recipients.updated, { newRecipients: [] }); expect(this.$node).not.toBeDisabled(); }); - it('gets enabled and remains enabled when a recipients:updated with recipients is followed by a inputHasNoMail', function () { + it('gets enabled and remains enabled when a recipients:updated with recipients is followed by a inputFieldIsEmpty', function () { this.$node.prop('disabled', true); $(document).trigger(Pixelated.events.ui.recipients.updated, { newRecipients: ['a@b.c']}); - $(document).trigger(Pixelated.events.ui.recipients.inputHasNoMail, { name: 'to' }); + $(document).trigger(Pixelated.events.ui.recipients.inputFieldIsEmpty, { name: 'to' }); expect(this.$node).not.toBeDisabled(); }); @@ -52,8 +52,8 @@ describeComponent('mail_view/ui/send_button', function () { this.$node.prop('disabled', false); }); - it('gets disabled in a inputHasNoMail', function () { - $(document).trigger(Pixelated.events.ui.recipients.inputHasNoMail, { name: 'to' }); + it('gets disabled in a inputFieldIsEmpty', function () { + $(document).trigger(Pixelated.events.ui.recipients.inputFieldIsEmpty, { name: 'to' }); expect(this.$node).toBeDisabled(); }); @@ -63,6 +63,14 @@ describeComponent('mail_view/ui/send_button', function () { expect(this.$node).toBeDisabled(); }); + + it('gets disabled if recipients:updated with invalid email', function () { + $(document).trigger(Pixelated.events.ui.recipients.inputFieldHasCharacters, { name: 'to' }); + $(document).trigger(Pixelated.events.ui.recipients.updated, { newRecipients: ['InvalidEmail']}); + + expect(this.$node).not.toBeDisabled(); + expect(this.$node.text()).toBe('Send'); + }); }); describe('on click', function () { |