diff options
author | Ola Bini <ola.bini@gmail.com> | 2014-07-31 19:29:33 -0300 |
---|---|---|
committer | Ola Bini <ola.bini@gmail.com> | 2014-07-31 19:29:33 -0300 |
commit | 04cf441c5ae18400c6b4865b0b37a71718dc9d46 (patch) | |
tree | dd0b0d049ec00389e2d4561b226c46eb1682b997 /web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js | |
parent | 639a663a4c37020003586438fdcd7ac529a00f10 (diff) |
Add web-ui based on previous code
Diffstat (limited to 'web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js')
-rw-r--r-- | web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js new file mode 100644 index 00000000..1b5899a1 --- /dev/null +++ b/web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js @@ -0,0 +1,40 @@ +/*global Smail */ + +describeMixin('mail_list/ui/mail_items/mail_item', function () { + 'use strict'; + + beforeEach(function () { + var mail = Smail.testData().parsedMail.simpleTextPlain; + mail.tags = ['inbox']; + + setupComponent('<li><input type="checkbox"></input></li>', { + mail: mail, + selected: false, + tag: 'inbox' + }); + }); + + describe('mail checkbox', function () { + var mailCheckedEvent, mailUncheckedEvent, checkbox; + beforeEach(function () { + mailCheckedEvent = spyOnEvent(document, Smail.events.ui.mail.checked); + mailUncheckedEvent = spyOnEvent(document, Smail.events.ui.mail.unchecked); + checkbox = this.component.$node.find('input[type=checkbox]'); + }); + + it('checkCheckbox checks it and triggers events.ui.mail.checked', function () { + this.component.checkCheckbox(); + + expect(checkbox.prop('checked')).toBe(true); + expect(mailCheckedEvent).toHaveBeenTriggeredOn(document); + }); + + it('uncheckCheckbox checks it and triggers events.ui.mail.checked', function () { + checkbox.prop('checked', true); + this.component.uncheckCheckbox(); + + expect(checkbox.prop('checked')).toBe(false); + expect(mailUncheckedEvent).toHaveBeenTriggeredOn(document); + }); + }); +}); |