summaryrefslogtreecommitdiff
path: root/web-ui/test/spec/mail_list
diff options
context:
space:
mode:
authorPatrick Maia <pixelated-team+patrick@thoughtworks.com>2014-08-08 17:51:33 -0300
committerPatrick Maia <patrickjourdanmaia@gmail.com>2014-08-08 17:51:33 -0300
commit97e762a0832593031ae71ab1e11d4c0e377a00f4 (patch)
tree213e835f4effbaf97f0922e5941065b1329d0501 /web-ui/test/spec/mail_list
parentf22a6a32e901f52b2b3f2b3fd8625c43302ff001 (diff)
replaces Smail by Pixelated in all js files
Diffstat (limited to 'web-ui/test/spec/mail_list')
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js22
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js8
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_list.spec.js86
3 files changed, 58 insertions, 58 deletions
diff --git a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js
index b49bc7f0..6c49c1cf 100644
--- a/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js
+++ b/web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js
@@ -4,7 +4,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
var mail;
beforeEach(function () {
- mail = Smail.testData().parsedMail.simpleTextPlain;
+ mail = Pixelated.testData().parsedMail.simpleTextPlain;
mail.tags = ['inbox'];
setupComponent('<li></li>', {
@@ -15,7 +15,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
});
it('should trigger ui:openMail on click', function () {
- var spyEvent = spyOnEvent(document, Smail.events.ui.mail.open);
+ var spyEvent = spyOnEvent(document, Pixelated.events.ui.mail.open);
this.component.$node.find('a').click();
@@ -30,7 +30,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
});
it('should remove selected class when selecting a different mail', function () {
- $(document).trigger(Smail.events.ui.mail.updateSelected, { ident: 2 });
+ $(document).trigger(Pixelated.events.ui.mail.updateSelected, { ident: 2 });
expect(this.$node).not.toHaveClass('selected');
});
@@ -38,7 +38,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
it('should remove selected class when enabling compose box', function () {
this.$node.find('a').click();
- $(document).trigger(Smail.events.ui.composeBox.newMessage);
+ $(document).trigger(Pixelated.events.ui.composeBox.newMessage);
expect(this.$node).not.toHaveClass('selected');
});
@@ -58,8 +58,8 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
it('triggers mail open and pushes the state', function () {
var clickEvent = createClickEvent();
- var mailOpenEvent = spyOnEvent(document, Smail.events.ui.mail.open);
- var pushStateEvent = spyOnEvent(document, Smail.events.router.pushState);
+ var mailOpenEvent = spyOnEvent(document, Pixelated.events.ui.mail.open);
+ var pushStateEvent = spyOnEvent(document, Pixelated.events.router.pushState);
$(this.$node.find('a')).trigger(clickEvent);
@@ -77,8 +77,8 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
], function (specialKey) {
it('doesnt trigger mail open and nor pushes the state', function () {
var clickEvent = createClickEvent(specialKey);
- var mailOpenEvent = spyOnEvent(document, Smail.events.ui.mail.open);
- var pushStateEvent = spyOnEvent(document, Smail.events.router.pushState);
+ var mailOpenEvent = spyOnEvent(document, Pixelated.events.ui.mail.open);
+ var pushStateEvent = spyOnEvent(document, Pixelated.events.router.pushState);
$(this.$node.find('a')).trigger(clickEvent);
@@ -89,7 +89,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
it('marks the email as read', function () {
debugger;
- var mailReadEvent = spyOnEvent(document, Smail.events.mail.read);
+ var mailReadEvent = spyOnEvent(document, Pixelated.events.mail.read);
var clickEvent = createClickEvent(specialKey);
$(this.$node.find('a')).trigger(clickEvent);
@@ -107,7 +107,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
describe('marking emails as read', function () {
it('should trigger mail:read event when unread is clicked', function () {
- var mailReadEvent = spyOnEvent(document, Smail.events.mail.read);
+ var mailReadEvent = spyOnEvent(document, Pixelated.events.mail.read);
this.$node.find('a').click();
@@ -115,7 +115,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
});
it('should not trigger mail:read event when clicking mail that is already read', function () {
- var mailReadEvent = spyOnEvent(document, Smail.events.mail.read);
+ var mailReadEvent = spyOnEvent(document, Pixelated.events.mail.read);
this.component.attr.mail.status.push(this.component.status.READ);
this.$node.find('a').click();
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
index 1b5899a1..8b0712c5 100644
--- 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
@@ -1,10 +1,10 @@
-/*global Smail */
+/*global Pixelated */
describeMixin('mail_list/ui/mail_items/mail_item', function () {
'use strict';
beforeEach(function () {
- var mail = Smail.testData().parsedMail.simpleTextPlain;
+ var mail = Pixelated.testData().parsedMail.simpleTextPlain;
mail.tags = ['inbox'];
setupComponent('<li><input type="checkbox"></input></li>', {
@@ -17,8 +17,8 @@ describeMixin('mail_list/ui/mail_items/mail_item', function () {
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);
+ mailCheckedEvent = spyOnEvent(document, Pixelated.events.ui.mail.checked);
+ mailUncheckedEvent = spyOnEvent(document, Pixelated.events.ui.mail.unchecked);
checkbox = this.component.$node.find('input[type=checkbox]');
});
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 f383d540..11993ba1 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
@@ -1,4 +1,4 @@
-/*global Smail */
+/*global Pixelated */
describeComponent('mail_list/ui/mail_list', function () {
'use strict';
@@ -30,12 +30,12 @@ describeComponent('mail_list/ui/mail_list', function () {
return '10';
}
};
- var openMailEvent = spyOnEvent(document, Smail.events.ui.mail.open);
+ var openMailEvent = spyOnEvent(document, Pixelated.events.ui.mail.open);
- this.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ this.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
expect(openMailEvent).toHaveBeenTriggeredOnAndWith(document, { ident: '10' });
- this.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ this.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
expect(openMailEvent.calls.length).toEqual(1);
});
@@ -48,10 +48,10 @@ describeComponent('mail_list/ui/mail_list', function () {
return '10';
}
};
- var pushState = spyOnEvent(document, Smail.events.router.pushState);
+ var pushState = spyOnEvent(document, Pixelated.events.router.pushState);
this.component.attr.currentTag = 'inbox';
- this.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ this.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
expect(pushState).toHaveBeenTriggeredOnAndWith(document, { tag: 'inbox', mailIdent: '10' });
});
@@ -63,7 +63,7 @@ describeComponent('mail_list/ui/mail_list', function () {
this.component.attr.checkedMails = {};
- $(document).trigger(Smail.events.ui.mail.checked, {mail: mailList[0]});
+ $(document).trigger(Pixelated.events.ui.mail.checked, {mail: mailList[0]});
checkedMails[mailList[0].ident] = mailList[0];
@@ -73,18 +73,18 @@ describeComponent('mail_list/ui/mail_list', function () {
it('returns the list of checked mails to whomever requests them', function () {
var caller = {};
this.component.attr.checkedMails = {'1': {}};
- var mailHereCheckedEvent = spyOnEvent(caller, Smail.events.ui.mail.hereChecked);
+ var mailHereCheckedEvent = spyOnEvent(caller, Pixelated.events.ui.mail.hereChecked);
- $(document).trigger(Smail.events.ui.mail.wantChecked, caller);
+ $(document).trigger(Pixelated.events.ui.mail.wantChecked, caller);
expect(mailHereCheckedEvent).toHaveBeenTriggeredOnAndWith(caller, { checkedMails: {'1': {} }});
});
it('returns an empty list to whomever requests the checked mails if there are no checked mails', function () {
var caller = {};
- var mailHereCheckedEvent = spyOnEvent(caller, Smail.events.ui.mail.hereChecked);
+ var mailHereCheckedEvent = spyOnEvent(caller, Pixelated.events.ui.mail.hereChecked);
- $(document).trigger(Smail.events.ui.mail.wantChecked, caller);
+ $(document).trigger(Pixelated.events.ui.mail.wantChecked, caller);
expect(mailHereCheckedEvent).toHaveBeenTriggeredOnAndWith(caller, { checkedMails: {} });
});
@@ -96,15 +96,15 @@ describeComponent('mail_list/ui/mail_list', function () {
'3': {}
};
- $(document).trigger(Smail.events.ui.mail.unchecked, {mail: {ident: '1'}});
+ $(document).trigger(Pixelated.events.ui.mail.unchecked, {mail: {ident: '1'}});
expect(this.component.attr.checkedMails).toEqual({'2': {}, '3': {} });
});
it('checks the check all checkbox if at least one mail is checked', function () {
- var setCheckAllCheckboxEvent = spyOnEvent(document, Smail.events.ui.mails.hasMailsChecked);
+ var setCheckAllCheckboxEvent = spyOnEvent(document, Pixelated.events.ui.mails.hasMailsChecked);
- $(document).trigger(Smail.events.ui.mail.checked, {mail: mailList[0]});
+ $(document).trigger(Pixelated.events.ui.mail.checked, {mail: mailList[0]});
expect(setCheckAllCheckboxEvent).toHaveBeenTriggeredOnAndWith(document, true);
});
@@ -112,9 +112,9 @@ describeComponent('mail_list/ui/mail_list', function () {
it('unchecks the check all checkbox if no mail is left checked', function () {
this.component.attr.checkedMails = {1: {}};
- var setCheckAllCheckboxEvent = spyOnEvent(document, Smail.events.ui.mails.hasMailsChecked);
+ var setCheckAllCheckboxEvent = spyOnEvent(document, Pixelated.events.ui.mails.hasMailsChecked);
- $(document).trigger(Smail.events.ui.mail.unchecked, {mail: {ident: '1'}});
+ $(document).trigger(Pixelated.events.ui.mail.unchecked, {mail: {ident: '1'}});
expect(setCheckAllCheckboxEvent).toHaveBeenTriggeredOnAndWith(document, false);
});
@@ -122,35 +122,35 @@ describeComponent('mail_list/ui/mail_list', function () {
describe('when mails are available', function () {
it('should open email if popstate event happened (when mailIdent isnt undefined)', function () {
- var openMailEvent = spyOnEvent(document, Smail.events.ui.mail.open);
+ var openMailEvent = spyOnEvent(document, Pixelated.events.ui.mail.open);
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList, mailIdent: '30' });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList, mailIdent: '30' });
expect(openMailEvent).toHaveBeenTriggeredOnAndWith(document, { ident: '30'});
});
it('should open draft in popstate event if tag is Drafts', function () {
- var openDraftEvent = spyOnEvent(document, Smail.events.dispatchers.rightPane.openDraft);
+ var openDraftEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openDraft);
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList, mailIdent: '30', tag: 'drafts' });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList, mailIdent: '30', tag: 'drafts' });
expect(openDraftEvent).toHaveBeenTriggeredOnAndWith(document, { ident: '30'});
});
});
it('should not append emails when another mails:available event is triggered', function () {
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
expect(this.component.$node.find('a').length).toEqual(2);
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
expect(this.component.$node.find('a').length).toEqual(2);
});
it('resets scroll when opening a new tag or choosing a new tag', function () {
- var eventSpy = spyOnEvent(document, Smail.events.dispatchers.middlePane.resetScroll);
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ var eventSpy = spyOnEvent(document, Pixelated.events.dispatchers.middlePane.resetScroll);
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
expect(eventSpy).toHaveBeenTriggeredOn(document);
});
@@ -158,7 +158,7 @@ describeComponent('mail_list/ui/mail_list', function () {
describe('when mails are available for refreshing', function () {
it('renders the new mails', function () {
- this.component.$node.trigger(Smail.events.mails.availableForRefresh, { mails: mailList });
+ this.component.$node.trigger(Pixelated.events.mails.availableForRefresh, { mails: mailList });
matchMail(mailList[0], this.component.$node);
matchMail(mailList[1], this.component.$node);
@@ -167,7 +167,7 @@ describeComponent('mail_list/ui/mail_list', function () {
});
it('should render all mails sent in ui:mails:show event', function () {
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList });
matchMail(mailList[0], this.component.$node);
matchMail(mailList[1], this.component.$node);
@@ -176,7 +176,7 @@ describeComponent('mail_list/ui/mail_list', function () {
it('should select the current email when mails are available', function () {
this.component.attr.currentMailIdent = '1';
- this.component.trigger(Smail.events.mails.available, { mails: mailList });
+ this.component.trigger(Pixelated.events.mails.available, { mails: mailList });
matchSelectedMail(mailList[0], this.component.$node);
matchMail(mailList[1], this.component.$node);
@@ -187,14 +187,14 @@ describeComponent('mail_list/ui/mail_list', function () {
mailIdent = mailList[0].ident;
this.component.attr.checkedMails[mailIdent] = mailList[0];
- this.component.$node.trigger(Smail.events.mails.available, { mails: [mailList[0]] });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: [mailList[0]] });
checkbox = this.$node.find('input[type=checkbox]');
expect(checkbox.prop('checked')).toBe(true);
});
it('should render links for the emails', function () {
- this.component.$node.trigger(Smail.events.mails.available, { mails: mailList, tag: 'inbox' });
+ this.component.$node.trigger(Pixelated.events.mails.available, { mails: mailList, tag: 'inbox' });
expect(this.$node.html()).toMatch('href="/#/inbox/mail/1');
expect(this.$node.html()).toMatch('href="/#/inbox/mail/2');
@@ -202,7 +202,7 @@ describeComponent('mail_list/ui/mail_list', function () {
it('should clean the selected email', function () {
this.component.attr.currentMailIdent = '1';
- this.component.trigger(Smail.events.ui.mails.cleanSelected);
+ this.component.trigger(Pixelated.events.ui.mails.cleanSelected);
expect(this.component.attr.currentMailIdent).toEqual('');
});
@@ -222,18 +222,18 @@ describeComponent('mail_list/ui/mail_list', function () {
describe('when saving a draft', function () {
it('refreshes the list if the current tag is drafts', function () {
this.component.attr.currentTag = 'drafts';
- var spyRefresh = spyOnEvent(document, Smail.events.ui.mails.refresh);
- var spyScroll = spyOnEvent(document, Smail.events.dispatchers.middlePane.resetScroll);
- this.component.trigger(Smail.events.mail.draftSaved, {ident: 1});
+ var spyRefresh = spyOnEvent(document, Pixelated.events.ui.mails.refresh);
+ var spyScroll = spyOnEvent(document, Pixelated.events.dispatchers.middlePane.resetScroll);
+ this.component.trigger(Pixelated.events.mail.draftSaved, {ident: 1});
expect(spyRefresh).toHaveBeenTriggeredOn(document);
expect(spyScroll).toHaveBeenTriggeredOn(document);
});
it('does not refresh the list if the current tag is not drafts', function() {
this.component.attr.currentTag = 'sent';
- var spyRefresh = spyOnEvent(document, Smail.events.ui.mails.refresh);
- var spyScroll = spyOnEvent(document, Smail.events.dispatchers.middlePane.resetScroll);
- this.component.trigger(Smail.events.mail.draftSaved, {ident: 1});
+ var spyRefresh = spyOnEvent(document, Pixelated.events.ui.mails.refresh);
+ var spyScroll = spyOnEvent(document, Pixelated.events.dispatchers.middlePane.resetScroll);
+ this.component.trigger(Pixelated.events.mail.draftSaved, {ident: 1});
expect(spyRefresh).not.toHaveBeenTriggeredOn(document);
expect(spyScroll).not.toHaveBeenTriggeredOn(document);
});
@@ -242,25 +242,25 @@ describeComponent('mail_list/ui/mail_list', function () {
describe('when sending a mail', function () {
it('refreshes the list if the current tag is drafts', function () {
this.component.attr.currentTag = 'drafts';
- var spyRefresh = spyOnEvent(document, Smail.events.ui.mails.refresh);
- var spyScroll = spyOnEvent(document, Smail.events.dispatchers.middlePane.resetScroll);
- this.component.trigger(Smail.events.mail.sent);
+ var spyRefresh = spyOnEvent(document, Pixelated.events.ui.mails.refresh);
+ var spyScroll = spyOnEvent(document, Pixelated.events.dispatchers.middlePane.resetScroll);
+ this.component.trigger(Pixelated.events.mail.sent);
expect(spyRefresh).toHaveBeenTriggeredOn(document);
expect(spyScroll).toHaveBeenTriggeredOn(document);
});
it('refreshes the list if the current tag is sent', function() {
this.component.attr.currentTag = 'sent';
- var spyRefresh = spyOnEvent(document, Smail.events.ui.mails.refresh);
- var spyScroll = spyOnEvent(document, Smail.events.dispatchers.middlePane.resetScroll);
- this.component.trigger(Smail.events.mail.sent);
+ var spyRefresh = spyOnEvent(document, Pixelated.events.ui.mails.refresh);
+ var spyScroll = spyOnEvent(document, Pixelated.events.dispatchers.middlePane.resetScroll);
+ this.component.trigger(Pixelated.events.mail.sent);
expect(spyRefresh).toHaveBeenTriggeredOn(document);
expect(spyScroll).toHaveBeenTriggeredOn(document);
});
});
function createMail(subject, from, ident, date) {
- var mail = Smail.testData().parsedMail.simpleTextPlain;
+ var mail = Pixelated.testData().parsedMail.simpleTextPlain;
return _.merge(mail, {
header: {