summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js2
-rw-r--r--web-ui/app/js/mail_list/ui/mail_items/mail_item.js10
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipient.js4
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipients.js2
-rw-r--r--web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js10
-rw-r--r--web-ui/bower.json26
-rw-r--r--web-ui/package.json3
-rw-r--r--web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js4
-rw-r--r--web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js2
-rw-r--r--web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js4
-rw-r--r--web-ui/test/spec/helpers/view_helper.spec.js2
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_items/generic_mail_item.spec.js2
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_items/mail_item.spec.js2
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_list.spec.js2
-rw-r--r--web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js2
-rw-r--r--web-ui/test/spec/mail_list_actions/ui/mail_actions.spec.js9
-rw-r--r--web-ui/test/spec/mail_list_actions/ui/pagination_trigger.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/data/mail_sender.spec.js26
-rw-r--r--web-ui/test/spec/mail_view/ui/compose_box.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/draft_box.spec.js8
-rw-r--r--web-ui/test/spec/mail_view/ui/draft_save_status.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/forward_box.spec.js20
-rw-r--r--web-ui/test/spec/mail_view/ui/mail_actions.spec.js5
-rw-r--r--web-ui/test/spec/mail_view/ui/mail_view.spec.js12
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js6
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_input.spec.js4
-rw-r--r--web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/reply_box.spec.js14
-rw-r--r--web-ui/test/spec/mail_view/ui/reply_section.spec.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/send_button.spec.js2
-rw-r--r--web-ui/test/spec/mixins/with_mail_edit_base.spec.js32
-rw-r--r--web-ui/test/spec/page/logout.spec.js8
-rw-r--r--web-ui/test/spec/page/pane_contract_expand.spec.js4
-rw-r--r--web-ui/test/spec/page/router.spec.js6
-rw-r--r--web-ui/test/spec/search/search_trigger.spec.js2
-rw-r--r--web-ui/test/spec/services/delete_service.spec.js2
-rw-r--r--web-ui/test/spec/services/mail_service.spec.js50
-rw-r--r--web-ui/test/spec/tags/data/tags.spec.js12
-rw-r--r--web-ui/test/spec/tags/ui/tag.spec.js12
-rw-r--r--web-ui/test/spec/tags/ui/tag_list.spec.js4
-rw-r--r--web-ui/test/spec/tags/ui/tag_shortcut.spec.js4
-rw-r--r--web-ui/test/spec/user_alerts/ui/user_alerts.spec.js2
42 files changed, 160 insertions, 171 deletions
diff --git a/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js
index d5dfbf28..c313b030 100644
--- a/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js
+++ b/web-ui/app/js/mail_list/ui/mail_items/generic_mail_item.js
@@ -102,7 +102,7 @@ define(
this.checkCheckbox();
}
- this.on(document, events.ui.composeBox.newMessage, this.unselect);
+ this.on(document, events.ui.composeBox.newMessage, this.doUnselect);
this.on(document, events.ui.mail.open, this.openMail);
this.on(document, events.ui.mail.updateSelected, this.updateSelected);
this.on(document, events.mails.teardown, this.teardown);
diff --git a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js
index 5f1f354a..51ace714 100644
--- a/web-ui/app/js/mail_list/ui/mail_items/mail_item.js
+++ b/web-ui/app/js/mail_list/ui/mail_items/mail_item.js
@@ -22,19 +22,19 @@ define(
function mailItem() {
this.updateSelected = function (ev, data) {
- if(data.ident === this.attr.ident) { this.select(); }
- else { this.unselect(); }
+ if(data.ident === this.attr.ident) { this.doSelect(); }
+ else { this.doUnselect(); }
};
this.formattedDate = function (date) {
return viewHelper.getFormattedDate(new Date(date));
};
- this.select = function () {
+ this.doSelect = function () {
this.$node.addClass('selected');
};
- this.unselect = function () {
+ this.doUnselect = function () {
this.$node.removeClass('selected');
};
@@ -70,7 +70,7 @@ define(
this.attachListeners = function () {
this.on(this.$node.find('input[type=checkbox]'), 'change', this.triggerMailChecked);
- this.on(document, events.ui.mails.cleanSelected, this.unselect);
+ this.on(document, events.ui.mails.cleanSelected, this.doUnselect);
this.on(document, events.ui.mails.uncheckAll, this.uncheckCheckbox);
this.on(document, events.ui.mails.checkAll, this.checkCheckbox);
};
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipient.js b/web-ui/app/js/mail_view/ui/recipients/recipient.js
index 327f40bb..004b9247 100644
--- a/web-ui/app/js/mail_view/ui/recipients/recipient.js
+++ b/web-ui/app/js/mail_view/ui/recipients/recipient.js
@@ -40,11 +40,11 @@ define(
this.teardown();
};
- this.select = function () {
+ this.doSelect = function () {
this.$node.find('.recipient-value').addClass('selected');
};
- this.unselect = function () {
+ this.doUnselect = function () {
this.$node.find('.recipient-value').removeClass('selected');
};
}
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients.js b/web-ui/app/js/mail_view/ui/recipients/recipients.js
index 1e4d909e..83761810 100644
--- a/web-ui/app/js/mail_view/ui/recipients/recipients.js
+++ b/web-ui/app/js/mail_view/ui/recipients/recipients.js
@@ -74,7 +74,7 @@ define(
exitInput: this.attr.input.$node
});
- this.attr.iterator.current().select();
+ this.attr.iterator.current().doSelect();
this.attr.input.$node.blur();
this.select('navigationHandler').focus();
};
diff --git a/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js b/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js
index 5253d915..38f18d61 100644
--- a/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js
+++ b/web-ui/app/js/mail_view/ui/recipients/recipients_iterator.js
@@ -31,15 +31,15 @@ define(['helpers/iterator'], function (Iterator) {
this.moveLeft = function () {
if (this.iterator.hasPrevious()) {
- this.iterator.current().unselect();
- this.iterator.previous().select();
+ this.iterator.current().doUnselect();
+ this.iterator.previous().doSelect();
}
};
this.moveRight = function () {
- this.iterator.current().unselect();
+ this.iterator.current().doUnselect();
if (this.iterator.hasNext()) {
- this.iterator.next().select();
+ this.iterator.next().doSelect();
} else {
this.input.focus();
}
@@ -49,7 +49,7 @@ define(['helpers/iterator'], function (Iterator) {
this.iterator.removeCurrent().destroy();
if (this.iterator.hasElements()) {
- this.iterator.current().select();
+ this.iterator.current().doSelect();
} else {
this.input.focus();
}
diff --git a/web-ui/bower.json b/web-ui/bower.json
index a7865fc3..ea8a5f7b 100644
--- a/web-ui/bower.json
+++ b/web-ui/bower.json
@@ -2,23 +2,23 @@
"name": "flightjs",
"version": "0.0.0",
"dependencies": {
- "jquery": "2.1.0",
- "flight": "~1.1.0",
- "requirejs": "~2.1.5",
- "lodash": "~2.4.1",
- "foundation": "5.3.0",
- "i18next": "~1.7.3",
- "font-awesome": "~4.1.0",
- "quoted-printable": "0.2.1"
+ "jquery": "2.1.1",
+ "flight": "1.3.0",
+ "requirejs": "2.1.5",
+ "lodash": "2.4.1",
+ "foundation": "5.4.6",
+ "i18next": "1.7.4",
+ "font-awesome": "4.2.0",
+ "quoted-printable": "0.2.1",
+ "typeahead.js": "0.10.2"
},
"devDependencies": {
- "jasmine-flight": "~2.2.0",
- "jasmine-jquery": "~1.7.0",
"handlebars": "~1.3.0",
- "typeahead.js": "~0.10.2",
- "almond": "~0.2.9"
+ "jasmine-flight": "3.0.0",
+ "jasmine-jquery": "2.0.5",
+ "almond": "~0.3.0"
},
"resolutions": {
- "jquery": ">= 2.1.0"
+ "jasmine-jquery": "2.0.5"
}
}
diff --git a/web-ui/package.json b/web-ui/package.json
index fe8bbab0..b72022e3 100644
--- a/web-ui/package.json
+++ b/web-ui/package.json
@@ -34,13 +34,14 @@
"grunt-rev": "~0.1.0",
"grunt-svgmin": "^0.2.1",
"grunt-usemin": "^2.3.0",
+ "gulp-handlebars": "^2.2.0",
"handlebars": "^2.0.0-alpha.4",
"jshint-stylish": "^0.2.0",
"karma": "~0.12.0",
"karma-chrome-launcher": "~0.1.0",
"karma-firefox-launcher": "~0.1.0",
"karma-ie-launcher": "~0.1.1",
- "karma-jasmine": "~0.1.0",
+ "karma-jasmine": "^0.2.2",
"karma-junit-reporter": "^0.2.2",
"karma-phantomjs-launcher": "~0.1.0",
"karma-requirejs": "~0.2.1",
diff --git a/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js b/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js
index 935bb917..df8169c6 100644
--- a/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js
+++ b/web-ui/test/spec/dispatchers/left_pane_dispatcher.spec.js
@@ -7,7 +7,7 @@ describeComponent('dispatchers/left_pane_dispatcher', function () {
it('asks for tags', function () {
var tagWantEvent = spyOnEvent(document, Pixelated.events.tags.want);
- setupComponent();
+ this.setupComponent();
expect(tagWantEvent).toHaveBeenTriggeredOn(document);
expect(tagWantEvent.mostRecentCall.data.caller[0]).toEqual(this.$node[0]);
@@ -16,7 +16,7 @@ describeComponent('dispatchers/left_pane_dispatcher', function () {
describe('after initialization', function () {
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
});
it('pushes the url state when a tag is selected but not for the first tag', function () {
diff --git a/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js b/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js
index f35218d0..1dfc7c84 100644
--- a/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js
+++ b/web-ui/test/spec/dispatchers/middle_pane_dispatchers.spec.js
@@ -4,7 +4,7 @@ describeComponent('dispatchers/middle_pane_dispatcher', function () {
'use strict';
beforeEach(function() {
- setupComponent('<div><div id="middle-pane" style="height: 200px; overflow-y: scroll;"><div style="height: 400px"></div></div></div>');
+ this.setupComponent('<div><div id="middle-pane" style="height: 200px; overflow-y: scroll;"><div style="height: 400px"></div></div></div>');
});
it ('listens to refresh mail list event', function() {
diff --git a/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js b/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js
index bac42252..89530ac8 100644
--- a/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js
+++ b/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js
@@ -6,7 +6,7 @@ describeComponent('dispatchers/right_pane_dispatcher', function () {
describe('after initialization', function () {
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
});
it('listens to open compose box event and creates a compose box', function () {
@@ -80,7 +80,7 @@ describeComponent('dispatchers/right_pane_dispatcher', function () {
it('opens the no message selected pane but doesnt push the state', function () {
var pushStateEvent = spyOnEvent(document, Pixelated.events.router.pushState);
- setupComponent();
+ this.setupComponent();
expect(noMessageSelectedPane.attachTo).toHaveBeenCalled();
expect(pushStateEvent).not.toHaveBeenTriggeredOn(document);
diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js
index 1dedca44..217ac890 100644
--- a/web-ui/test/spec/helpers/view_helper.spec.js
+++ b/web-ui/test/spec/helpers/view_helper.spec.js
@@ -76,7 +76,7 @@ define(['helpers/view_helper'], function (viewHelper) {
viewHelper.moveCaretToEndOfText();
- expect(window.setTimeout.calls[0].args[1]).toEqual(1);
+ expect(window.setTimeout.calls.all()[0].args[1]).toEqual(1);
});
});
});
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 b03babb5..3541506c 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
@@ -8,7 +8,7 @@ describeComponent('mail_list/ui/mail_items/generic_mail_item', function () {
mail.tags = [];
mail.mailbox = 'inbox';
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
mail: mail,
selected: false,
tag: 'inbox'
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 8b0712c5..5c965b71 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
@@ -7,7 +7,7 @@ describeMixin('mail_list/ui/mail_items/mail_item', function () {
var mail = Pixelated.testData().parsedMail.simpleTextPlain;
mail.tags = ['inbox'];
- setupComponent('<li><input type="checkbox"></input></li>', {
+ this.setupComponent('<li><input type="checkbox"></input></li>', {
mail: mail,
selected: false,
tag: 'inbox'
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 9c01c6af..872c7bb4 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
@@ -6,7 +6,7 @@ describeComponent('mail_list/ui/mail_list', function () {
var mailList;
beforeEach(function () {
- setupComponent('<div id="mails"></div>', {
+ this.setupComponent('<div id="mails"></div>', {
urlParams: {
hasMailIdent: function () {
return false;
diff --git a/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js b/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js
index 78104ce9..5e65ddbb 100644
--- a/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js
+++ b/web-ui/test/spec/mail_list_actions/ui/compose_trigger.spec.js
@@ -2,7 +2,7 @@ describeComponent('mail_list_actions/ui/compose_trigger', function () {
'use strict';
beforeEach(function () {
- setupComponent('<div></div>');
+ this.setupComponent('<div></div>');
});
it('triggers the enableComposebox event when clicked', function () {
diff --git a/web-ui/test/spec/mail_list_actions/ui/mail_actions.spec.js b/web-ui/test/spec/mail_list_actions/ui/mail_actions.spec.js
deleted file mode 100644
index f7a0ed72..00000000
--- a/web-ui/test/spec/mail_list_actions/ui/mail_actions.spec.js
+++ /dev/null
@@ -1,9 +0,0 @@
-describeComponent('mail_list_actions/ui/mail_actions', function () {
- 'use strict';
-
- beforeEach(function () {
- setupComponent();
- });
-
-
-});
diff --git a/web-ui/test/spec/mail_list_actions/ui/pagination_trigger.spec.js b/web-ui/test/spec/mail_list_actions/ui/pagination_trigger.spec.js
index d23c2839..5775a2c5 100644
--- a/web-ui/test/spec/mail_list_actions/ui/pagination_trigger.spec.js
+++ b/web-ui/test/spec/mail_list_actions/ui/pagination_trigger.spec.js
@@ -2,7 +2,7 @@ describeComponent('mail_list_actions/ui/pagination_trigger', function () {
'use strict';
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
});
it('triggers the ui:page:previous event when the left arrow is clicked', function () {
diff --git a/web-ui/test/spec/mail_view/data/mail_sender.spec.js b/web-ui/test/spec/mail_view/data/mail_sender.spec.js
index f5a0dd92..3f6a2eaa 100644
--- a/web-ui/test/spec/mail_view/data/mail_sender.spec.js
+++ b/web-ui/test/spec/mail_view/data/mail_sender.spec.js
@@ -9,14 +9,14 @@ describeComponent('mail_view/data/mail_sender', function () {
beforeEach(function () {
mailBuilder = require('mail_view/data/mail_builder');
mail = Pixelated.testData().parsedMail.simpleTextPlain;
- setupComponent();
+ this.setupComponent();
});
it('sends mail data with a POST to the server when asked to send email', function() {
var mailSentEventSpy = spyOnEvent(document, Pixelated.events.mail.sent);
var g;
- spyOn($, 'ajax').andReturn({done: function(f) { g = f; return {fail: function(){}};}});
+ spyOn($, 'ajax').and.returnValue({done: function(f) { g = f; return {fail: function(){}};}});
this.component.trigger(Pixelated.events.mail.send, mail);
@@ -24,17 +24,17 @@ describeComponent('mail_view/data/mail_sender', function () {
expect(mailSentEventSpy).toHaveBeenTriggeredOn(document);
- expect($.ajax.mostRecentCall.args[0]).toEqual('/mails');
- expect($.ajax.mostRecentCall.args[1].type).toEqual('POST');
- expect(JSON.parse($.ajax.mostRecentCall.args[1].data).header).toEqual(mail.header);
- expect(JSON.parse($.ajax.mostRecentCall.args[1].data).body).toEqual(mail.body);
+ expect($.ajax.calls.mostRecent().args[0]).toEqual('/mails');
+ expect($.ajax.calls.mostRecent().args[1].type).toEqual('POST');
+ expect(JSON.parse($.ajax.calls.mostRecent().args[1].data).header).toEqual(mail.header);
+ expect(JSON.parse($.ajax.calls.mostRecent().args[1].data).body).toEqual(mail.body);
});
it('save draft data with a PUT to the server', function() {
var draftSavedEventSpy = spyOnEvent(document, Pixelated.events.mail.draftSaved);
var g;
- spyOn($, 'ajax').andReturn({done: function(f) { g = f; return {fail: function(){}};}});
+ spyOn($, 'ajax').and.returnValue({done: function(f) { g = f; return {fail: function(){}};}});
mail.ident = 0;
this.component.trigger(Pixelated.events.mail.saveDraft, mail);
@@ -43,10 +43,10 @@ describeComponent('mail_view/data/mail_sender', function () {
expect(draftSavedEventSpy).toHaveBeenTriggeredOn(document);
- expect($.ajax.mostRecentCall.args[0]).toEqual('/mails');
- expect($.ajax.mostRecentCall.args[1].type).toEqual('PUT');
- expect(JSON.parse($.ajax.mostRecentCall.args[1].data).header).toEqual(mail.header);
- expect(JSON.parse($.ajax.mostRecentCall.args[1].data).body).toEqual(mail.body);
+ expect($.ajax.calls.mostRecent().args[0]).toEqual('/mails');
+ expect($.ajax.calls.mostRecent().args[1].type).toEqual('PUT');
+ expect(JSON.parse($.ajax.calls.mostRecent().args[1].data).header).toEqual(mail.header);
+ expect(JSON.parse($.ajax.calls.mostRecent().args[1].data).body).toEqual(mail.body);
});
it('displays generic error message when sending an email fails in the service', function () {
@@ -55,7 +55,7 @@ describeComponent('mail_view/data/mail_sender', function () {
deferred.reject({responseJSON: {}}, 500, 'Internal Server Error');
var messageEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
- spyOn($, 'ajax').andReturn(deferred);
+ spyOn($, 'ajax').and.returnValue(deferred);
this.component.trigger(Pixelated.events.mail.send, mail);
@@ -68,7 +68,7 @@ describeComponent('mail_view/data/mail_sender', function () {
deferred.reject({responseJSON: {message: 'test: error message'}}, 422, 'Unprocessable Entity');
var messageEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
- spyOn($, 'ajax').andReturn(deferred);
+ spyOn($, 'ajax').and.returnValue(deferred);
this.component.trigger(Pixelated.events.mail.send, mail);
diff --git a/web-ui/test/spec/mail_view/ui/compose_box.spec.js b/web-ui/test/spec/mail_view/ui/compose_box.spec.js
index f5abac42..d17d4b17 100644
--- a/web-ui/test/spec/mail_view/ui/compose_box.spec.js
+++ b/web-ui/test/spec/mail_view/ui/compose_box.spec.js
@@ -5,7 +5,7 @@ describeComponent('mail_view/ui/compose_box', function () {
'use strict';
beforeEach(function () {
Pixelated.mockBloodhound();
- setupComponent('<div style="display:none"></div>');
+ this.setupComponent('<div style="display:none"></div>');
});
diff --git a/web-ui/test/spec/mail_view/ui/draft_box.spec.js b/web-ui/test/spec/mail_view/ui/draft_box.spec.js
index 9a93791d..19b264b0 100644
--- a/web-ui/test/spec/mail_view/ui/draft_box.spec.js
+++ b/web-ui/test/spec/mail_view/ui/draft_box.spec.js
@@ -14,7 +14,7 @@ describeComponent('mail_view/ui/draft_box', function () {
it('fetches the email to draft', function () {
var mailWantEvent = spyOnEvent(document, Pixelated.events.mail.want);
- setupComponent({mailIdent: '1'});
+ this.setupComponent({mailIdent: '1'});
expect(mailWantEvent).toHaveBeenTriggeredOnAndWith(document, {
mail: '1', caller: this.component
@@ -24,7 +24,7 @@ describeComponent('mail_view/ui/draft_box', function () {
describe('after initialize', function () {
beforeEach(function () {
- setupComponent({mailIdent: '1'});
+ this.setupComponent({mailIdent: '1'});
});
it('renders the compose box when mail is received', function () {
@@ -44,7 +44,7 @@ describeComponent('mail_view/ui/draft_box', function () {
});
it('sending a draft sends the correct mailIdent', function () {
- setupComponent({mailIdent: mail.ident});
+ this.setupComponent({mailIdent: mail.ident});
this.component.trigger(this.component, Pixelated.events.mail.here, { mail: mail});
var sendDraftEvent = spyOnEvent(document, Pixelated.events.mail.saveDraft);
@@ -56,7 +56,7 @@ describeComponent('mail_view/ui/draft_box', function () {
it('shows no message selected pane when draft is sent', function() {
var openNoMessageSelectedEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openNoMessageSelected);
- setupComponent({mailIdent: mail.ident});
+ this.setupComponent({mailIdent: mail.ident});
this.component.trigger(this.component, Pixelated.events.mail.here, { mail: mail});
this.component.trigger(document, Pixelated.events.mail.sent);
diff --git a/web-ui/test/spec/mail_view/ui/draft_save_status.spec.js b/web-ui/test/spec/mail_view/ui/draft_save_status.spec.js
index bbcd6b1a..0e428066 100644
--- a/web-ui/test/spec/mail_view/ui/draft_save_status.spec.js
+++ b/web-ui/test/spec/mail_view/ui/draft_save_status.spec.js
@@ -3,7 +3,7 @@
describeComponent('mail_view/ui/draft_save_status', function () {
'use strict';
- beforeEach(setupComponent);
+ beforeEach(this.setupComponent);
it('should be empty on initialization', function() {
expect(this.$node.text()).toBe('');
diff --git a/web-ui/test/spec/mail_view/ui/forward_box.spec.js b/web-ui/test/spec/mail_view/ui/forward_box.spec.js
index cba50bc9..30b3b064 100644
--- a/web-ui/test/spec/mail_view/ui/forward_box.spec.js
+++ b/web-ui/test/spec/mail_view/ui/forward_box.spec.js
@@ -14,7 +14,7 @@ describeComponent('mail_view/ui/forward_box', function () {
it('should have a subject of Fwd: <original_message>', function() {
testMail.header.subject = 'Very interesting';
- setupComponent({ mail: testMail });
+ this.setupComponent({ mail: testMail });
expect(this.component.select('subjectDisplay').text()).toEqual('Fwd: '+ testMail.header.subject);
});
@@ -23,25 +23,25 @@ describeComponent('mail_view/ui/forward_box', function () {
var Recipients = require('mail_view/ui/recipients/recipients');
spyOn(Recipients, 'attachTo');
- setupComponent({ mail: testMail });
+ this.setupComponent({ mail: testMail });
- expect(Recipients.attachTo.calls[0].args[1]).toEqual({name: 'to', addresses: []});
- expect(Recipients.attachTo.calls[1].args[1]).toEqual({name: 'cc', addresses: []});
- expect(Recipients.attachTo.calls[2].args[1]).toEqual({name: 'bcc', addresses: []});
+ expect(Recipients.attachTo.calls.all()[0].args[1]).toEqual({name: 'to', addresses: []});
+ expect(Recipients.attachTo.calls.all()[1].args[1]).toEqual({name: 'cc', addresses: []});
+ expect(Recipients.attachTo.calls.all()[2].args[1]).toEqual({name: 'bcc', addresses: []});
});
it('should populate body text area with quote of email being forwarded', function() {
var viewHelper = require('helpers/view_helper');
- spyOn(viewHelper, 'quoteMail').andReturn('quoted email');
+ spyOn(viewHelper, 'quoteMail').and.returnValue('quoted email');
- setupComponent({ mail: testMail });
+ this.setupComponent({ mail: testMail });
expect(viewHelper.quoteMail).toHaveBeenCalledWith(testMail);
expect(this.component.select('bodyBox').val()).toBe('quoted email');
});
it('should show subject field when clicking on subject display', function() {
- setupComponent({ mail: testMail });
+ this.setupComponent({ mail: testMail });
this.component.select('subjectDisplay').click();
@@ -61,7 +61,7 @@ describeComponent('mail_view/ui/forward_box', function () {
testMail.header.sender = 'original_sender';
testMail.header.to = 'original_to@email.com';
- setupComponent({ mail: testMail });
+ this.setupComponent({ mail: testMail });
this.component.attr.recipientValues.to.push('forward_to@email.com');
$(document).trigger(Pixelated.events.ui.mail.send);
@@ -83,7 +83,7 @@ describeComponent('mail_view/ui/forward_box', function () {
it('triggers openMail when email is sent', function() {
var eventSpy = spyOnEvent(document, Pixelated.events.ui.mail.open);
- setupComponent({ mail: testMail });
+ this.setupComponent({ mail: testMail });
$(document).trigger(Pixelated.events.mail.sent, {ident: testMail.ident});
expect(eventSpy).toHaveBeenTriggeredOnAndWith(document, {ident: testMail.ident});
});
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
index cee4f689..897726b6 100644
--- a/web-ui/test/spec/mail_view/ui/mail_actions.spec.js
+++ b/web-ui/test/spec/mail_view/ui/mail_actions.spec.js
@@ -7,7 +7,7 @@ describeComponent('mail_view/ui/mail_actions', function () {
beforeEach(function(){
testData = Pixelated.testData();
- setupComponent(testData);
+ this.setupComponent(testData.rawMail);
});
it('verifies if more actions list is hidden when rendering mail view', function() {
@@ -48,13 +48,12 @@ describeComponent('mail_view/ui/mail_actions', function () {
});
it('triggers a delete event when clicking on delete-button-top', function(){
-
var deleteEvent = spyOnEvent(document, Pixelated.events.ui.mail.delete);
this.component.select('viewMoreActions').click();
this.component.select('deleteButtonTop').click();
- expect(deleteEvent).toHaveBeenTriggeredOnAndWith(document, {mail: testData.mail});
+ expect(deleteEvent).toHaveBeenTriggeredOnAndWith(document, {mail: testData.rawMail.mail});
var moreActionsComponent = this.component.select('moreActions');
expect(moreActionsComponent.attr('style').trim()).toEqual('display: none;');
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 9fed8275..1cc7eff0 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
@@ -11,13 +11,13 @@ describeComponent('mail_view/ui/mail_view', function () {
mail = {ident: 1, header: { date: '12/12/12T12:12' }, tags: ['inbox']};
testData = {mail: Pixelated.testData().parsedMail.simpleTextPlain};
Pixelated.mockBloodhound();
- setupComponent('<div></div>', {mail: mail});
+ this.setupComponent('<div></div>', {mail: mail});
});
it('triggers mail:want on ui:openMail', function () {
var spyEvent = spyOnEvent(document, Pixelated.events.mail.want);
- setupComponent('<div></div>', {ident: mail.ident });
+ this.setupComponent('<div></div>', {ident: mail.ident });
expect(spyEvent).toHaveBeenTriggeredOn(document);
expect(spyEvent.mostRecentCall.data.mail).toEqual(1);
@@ -137,25 +137,25 @@ describeComponent('mail_view/ui/mail_view', function () {
});
it('shows that mail is encrypted if it is', function() {
- spyOn(this.component, 'checkEncrypted').andReturn('encrypted');
+ spyOn(this.component, 'checkEncrypted').and.returnValue('encrypted');
this.component.displayMail({}, testData);
expect(this.component.$node.find('.encrypted')).toExist();
});
it('shows that mail is signed if it is', function() {
- spyOn(this.component, 'checkSigned').andReturn('signed');
+ spyOn(this.component, 'checkSigned').and.returnValue('signed');
this.component.displayMail({}, testData);
expect(this.component.$node.find('.signed')).toExist();
});
it('shows that mail is not encrypted if it isn\'t', function() {
- spyOn(this.component, 'checkEncrypted').andReturn('not-encrypted');
+ spyOn(this.component, 'checkEncrypted').and.returnValue('not-encrypted');
this.component.displayMail({}, testData);
expect(this.component.$node.find('.not-encrypted')).toExist();
});
it('shows that mail is not signed if it isn\'t', function() {
- spyOn(this.component, 'checkEncrypted').andReturn('not-signed');
+ spyOn(this.component, 'checkEncrypted').and.returnValue('not-signed');
this.component.displayMail({}, testData);
expect(this.component.$node.find('.not-signed')).toExist();
});
diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js
index 672cf4a3..6aa4589a 100644
--- a/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js
+++ b/web-ui/test/spec/mail_view/ui/recipients/recipients.spec.js
@@ -6,21 +6,21 @@ describeComponent('mail_view/ui/recipients/recipients',function () {
describe('initialization', function() {
it('adds recipients', function() {
- setupComponent({name: 'to', addresses: ['foobar@gmail.com'] });
+ this.setupComponent({name: 'to', addresses: ['foobar@gmail.com'] });
expect(this.component.attr.recipients.length).toBe(1);
});
it('does not trigger recipients updated events on initialization', function() {
recipientsUpdatedEvent = spyOnEvent(document, Pixelated.events.ui.recipients.updated);
- setupComponent({name: 'to', addresses: ['foobar@gmail.com'] });
+ this.setupComponent({name: 'to', addresses: ['foobar@gmail.com'] });
expect(recipientsUpdatedEvent).not.toHaveBeenTriggeredOn(document);
});
});
describe('adding recipients from the ui', function() {
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
recipientsUpdatedEvent = spyOnEvent(document, Pixelated.events.ui.recipients.updated);
this.component.trigger(Pixelated.events.ui.recipients.entered, {name: 'to', addresses: ['foobar@gmail.com'] });
});
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 56bb1120..499065c2 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
@@ -2,7 +2,7 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
'use strict';
beforeEach(function () {
- setupComponent({name: 'to'});
+ this.setupComponent({name: 'to'});
});
describe('keys that finish address input', function () {
@@ -42,7 +42,7 @@ describeComponent('mail_view/ui/recipients/recipients_input',function () {
this.$node.trigger(enterAddressKeyPressEvent);
expect(enterAddressKeyPressEvent.preventDefault).toHaveBeenCalled();
- enterAddressKeyPressEvent.preventDefault.reset();
+ enterAddressKeyPressEvent.preventDefault.calls.reset();
this.$node.val('anything');
this.$node.trigger(enterAddressKeyPressEvent);
expect(enterAddressKeyPressEvent.preventDefault).toHaveBeenCalled();
diff --git a/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js b/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js
index 74e5c614..60ea6526 100644
--- a/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js
+++ b/web-ui/test/spec/mail_view/ui/recipients/recipients_iterator.spec.js
@@ -15,7 +15,7 @@ define(['mail_view/ui/recipients/recipients_iterator'], function (RecipientsIter
}
function resetMock(m) {
- m.destroy.reset();m.select.reset();m.unselect.reset();
+ m.destroy.calls.reset();m.select.calls.reset();m.unselect.calls.reset();
}
beforeEach(function () {
diff --git a/web-ui/test/spec/mail_view/ui/reply_box.spec.js b/web-ui/test/spec/mail_view/ui/reply_box.spec.js
index fa229506..c81af683 100644
--- a/web-ui/test/spec/mail_view/ui/reply_box.spec.js
+++ b/web-ui/test/spec/mail_view/ui/reply_box.spec.js
@@ -9,7 +9,7 @@ describeComponent('mail_view/ui/reply_box', function () {
attrs = {
mail: Pixelated.testData().parsedMail.simpleTextPlain
};
- setupComponent(attrs);
+ this.setupComponent(attrs);
i18n = require('views/i18n');
});
@@ -35,7 +35,7 @@ describeComponent('mail_view/ui/reply_box', function () {
it('should use the from field when Reply-To header does not exist', function() {
attrs.mail.header.reply_to = undefined;
- setupComponent(attrs);
+ this.setupComponent(attrs);
expect(this.component.attr.recipientValues.to).toEqual([attrs.mail.header.from]);
});
@@ -43,7 +43,7 @@ describeComponent('mail_view/ui/reply_box', function () {
it('should have a subject of Re: <original_message>', function() {
attrs.mail.header.subject = 'Very interesting';
- setupComponent(attrs);
+ this.setupComponent(attrs);
expect(this.component.select('subjectDisplay').text()).toEqual(i18n('Re: ')+ attrs.mail.header.subject);
});
@@ -52,7 +52,7 @@ describeComponent('mail_view/ui/reply_box', function () {
var mailSendEvent = spyOnEvent(document, Pixelated.events.mail.send);
attrs.mail.header.message_id = '12345';
- setupComponent(attrs);
+ this.setupComponent(attrs);
$(document).trigger(Pixelated.events.ui.mail.send);
@@ -66,7 +66,7 @@ describeComponent('mail_view/ui/reply_box', function () {
var mailSendEvent = spyOnEvent(document, Pixelated.events.mail.send);
attrs.mail.header.list_id = 'somelist';
- setupComponent(attrs);
+ this.setupComponent(attrs);
$(document).trigger(Pixelated.events.ui.mail.send);
expect(mailSendEvent.mostRecentCall.data.header).toEqual(jasmine.objectContaining({
@@ -76,9 +76,9 @@ describeComponent('mail_view/ui/reply_box', function () {
it('populates body text area with quote of email being replied', function() {
var viewHelper = require('helpers/view_helper');
- spyOn(viewHelper, 'quoteMail').andReturn('quoted email');
+ spyOn(viewHelper, 'quoteMail').and.returnValue('quoted email');
- setupComponent(attrs);
+ this.setupComponent(attrs);
expect(viewHelper.quoteMail).toHaveBeenCalledWith(attrs.mail);
expect(this.component.select('bodyBox').val()).toBe('quoted email');
diff --git a/web-ui/test/spec/mail_view/ui/reply_section.spec.js b/web-ui/test/spec/mail_view/ui/reply_section.spec.js
index c49c0dda..6bd906bc 100644
--- a/web-ui/test/spec/mail_view/ui/reply_section.spec.js
+++ b/web-ui/test/spec/mail_view/ui/reply_section.spec.js
@@ -5,7 +5,7 @@ describeComponent('mail_view/ui/reply_section', function () {
'use strict';
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
});
describe('clicking reply buttons', 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 06f3b003..e97165f1 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 () {
- setupComponent('<button />');
+ this.setupComponent('<button />');
});
describe('when it is disabled', function () {
diff --git a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js
index f62c1f75..9f1b47d4 100644
--- a/web-ui/test/spec/mixins/with_mail_edit_base.spec.js
+++ b/web-ui/test/spec/mixins/with_mail_edit_base.spec.js
@@ -7,7 +7,7 @@ describeMixin('mixins/with_mail_edit_base', function () {
'use strict';
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
// Stubing mixing wrongly!!! 'deprecated' while waiting for draft component extraction
this.component.buildMail = function (tag) {
return { header: { to: ['a@smth.com'], from: 'b@smth.com', subject: 'Sbject' } };
@@ -34,28 +34,26 @@ describeMixin('mixins/with_mail_edit_base', function () {
this.component.attr.saveDraftInterval = 10;
});
- it('saves the draft after the save draft interval number of seconds', function() {
+ it('saves the draft after the save draft interval number of seconds', function(done) {
var saveDraftSpy = spyOnEvent(document, Pixelated.events.mail.saveDraft);
- runs(function () {
- this.component.monitorInput();
- expect(saveDraftSpy).not.toHaveBeenTriggeredOn(document);
- });
- waits(10);
- runs(function () {
+ this.component.monitorInput();
+ expect(saveDraftSpy).not.toHaveBeenTriggeredOn(document);
+
+ setTimeout(function () {
expect(saveDraftSpy).toHaveBeenTriggeredOn(document);
- });
+ done()
+ }, 10);
});
- it('does not save if mail is sent before the save draft interval number of seconds', function() {
+ it('does not save if mail is sent before the save draft interval number of seconds', function(done) {
var saveDraftSpy = spyOnEvent(document, Pixelated.events.mail.saveDraft);
- runs(function () {
- this.component.monitorInput();
- this.component.sendMail();
- });
- waits(10);
- runs(function () {
+ this.component.monitorInput();
+ this.component.sendMail();
+
+ setTimeout(function () {
expect(saveDraftSpy).not.toHaveBeenTriggeredOn(document);
- });
+ done();
+ }, 10);
});
});
diff --git a/web-ui/test/spec/page/logout.spec.js b/web-ui/test/spec/page/logout.spec.js
index fa1b2634..9285013a 100644
--- a/web-ui/test/spec/page/logout.spec.js
+++ b/web-ui/test/spec/page/logout.spec.js
@@ -11,9 +11,9 @@ describeComponent('page/logout', function () {
});
it('should provide logout link if logout is enabled', function () {
- spyOn(features, 'isLogoutEnabled').andReturn(true);
+ spyOn(features, 'isLogoutEnabled').and.returnValue(true);
- setupComponent('<div id="logout"></div>', {});
+ this.setupComponent('<div id="logout"></div>', {});
var logout_link = this.component.$node.find('a')[0];
expect(logout_link).toExist();
@@ -21,9 +21,9 @@ describeComponent('page/logout', function () {
});
it('should not provide logout link if disabled', function() {
- spyOn(features, 'isLogoutEnabled').andReturn(false);
+ spyOn(features, 'isLogoutEnabled').and.returnValue(false);
- setupComponent('<div id="logout"></div>', {});
+ this.setupComponent('<div id="logout"></div>', {});
var logout_link = this.component.$node.find('a')[0];
expect(logout_link).not.toExist();
diff --git a/web-ui/test/spec/page/pane_contract_expand.spec.js b/web-ui/test/spec/page/pane_contract_expand.spec.js
index 9a09edb2..61d786eb 100644
--- a/web-ui/test/spec/page/pane_contract_expand.spec.js
+++ b/web-ui/test/spec/page/pane_contract_expand.spec.js
@@ -23,7 +23,7 @@ describeComponent('page/pane_contract_expand', function () {
describe('after initialization', function () {
beforeEach(function () {
- setupComponent(document);
+ this.setupComponent(document);
});
it('contracts middle pane and expands right pane on mail open', function () {
@@ -57,7 +57,7 @@ describeComponent('page/pane_contract_expand', function () {
describe('on initialization', function () {
it('expands middle pane and contracts right pane', function () {
- setupComponent(document);
+ this.setupComponent(document);
expect($('#middle-pane-container').attr('class')).toEqual(this.component.attr.MIDDLE_PANE_EXPAND_CLASSES);
expect($('#right-pane').attr('class')).toEqual(this.component.attr.RIGHT_PANE_CONTRACT_CLASSES);
diff --git a/web-ui/test/spec/page/router.spec.js b/web-ui/test/spec/page/router.spec.js
index 6fdd404a..7340ecad 100644
--- a/web-ui/test/spec/page/router.spec.js
+++ b/web-ui/test/spec/page/router.spec.js
@@ -8,7 +8,7 @@ describeComponent('page/router', function () {
describe('on router:pushState coming from a tag selection', function () {
beforeEach(function () {
fakeHistory = jasmine.createSpyObj('history', ['pushState']);
- setupComponent({history: fakeHistory});
+ this.setupComponent({history: fakeHistory});
});
it('pushes the state with the tag and the url', function () {
@@ -41,7 +41,7 @@ describeComponent('page/router', function () {
it('when popping a state with no tag should select tag from url', function () {
var urlParams = require('page/router/url_params');
- spyOn(urlParams, 'getTag').andReturn('tag');
+ spyOn(urlParams, 'getTag').and.returnValue('tag');
var selectTagEvent = spyOnEvent(document, Pixelated.events.ui.tag.select);
@@ -52,7 +52,7 @@ describeComponent('page/router', function () {
it('when popping a state triggers the displayNoMessage pane if required', function () {
var urlParams = require('page/router/url_params');
- spyOn(urlParams, 'getTag').andReturn('tag');
+ spyOn(urlParams, 'getTag').and.returnValue('tag');
var displayNoMessageEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openNoMessageSelectedWithoutPushState);
diff --git a/web-ui/test/spec/search/search_trigger.spec.js b/web-ui/test/spec/search/search_trigger.spec.js
index c547df7a..1cc72847 100644
--- a/web-ui/test/spec/search/search_trigger.spec.js
+++ b/web-ui/test/spec/search/search_trigger.spec.js
@@ -6,7 +6,7 @@ describeComponent('search/search_trigger', function () {
var self;
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
self = this;
});
diff --git a/web-ui/test/spec/services/delete_service.spec.js b/web-ui/test/spec/services/delete_service.spec.js
index 9652e9d5..d07b36b2 100644
--- a/web-ui/test/spec/services/delete_service.spec.js
+++ b/web-ui/test/spec/services/delete_service.spec.js
@@ -7,7 +7,7 @@ describeComponent('services/delete_service', function () {
var i18n;
beforeEach( function () {
- setupComponent();
+ this.setupComponent();
i18n = require('views/i18n');
});
diff --git a/web-ui/test/spec/services/mail_service.spec.js b/web-ui/test/spec/services/mail_service.spec.js
index 897d3d5f..eba81ef3 100644
--- a/web-ui/test/spec/services/mail_service.spec.js
+++ b/web-ui/test/spec/services/mail_service.spec.js
@@ -7,24 +7,24 @@ describeComponent('services/mail_service', function () {
var email1, i18n;
beforeEach( function () {
- setupComponent();
+ this.setupComponent();
email1 = Pixelated.testData().parsedMail.simpleTextPlain;
i18n = require('views/i18n');
} );
it('marks the desired message as read', function () {
- var readRequest = spyOn($, 'ajax').andReturn({});
+ var readRequest = spyOn($, 'ajax').and.returnValue({});
this.component.trigger(Pixelated.events.mail.read, {ident: 1});
- expect(readRequest.mostRecentCall.args[0]).toEqual('/mail/1/read');
+ expect(readRequest.calls.mostRecent().args[0]).toEqual('/mail/1/read');
});
describe('when marks many emails as read', function () {
var readRequest, checkedMails, uncheckedEmailsEvent, setCheckAllEvent, doneMarkAsRead;
beforeEach(function () {
- readRequest = spyOn($, 'ajax').andReturn({done: function(f) { doneMarkAsRead = f; return {fail: function() {}};}});
+ readRequest = spyOn($, 'ajax').and.returnValue({done: function(f) { doneMarkAsRead = f; return {fail: function() {}};}});
uncheckedEmailsEvent = spyOnEvent(document, Pixelated.events.ui.mail.unchecked);
setCheckAllEvent = spyOnEvent(document, Pixelated.events.ui.mails.hasMailsChecked);
spyOn(this.component, 'refreshResults');
@@ -38,8 +38,8 @@ describeComponent('services/mail_service', function () {
});
it('makes the correct request to the backend', function () {
- expect(readRequest.mostRecentCall.args[0]).toEqual('/mails/read');
- expect(readRequest.mostRecentCall.args[1].data).toEqual({idents: '[1,2]'});
+ expect(readRequest.calls.mostRecent().args[0]).toEqual('/mails/read');
+ expect(readRequest.calls.mostRecent().args[1].data).toEqual({idents: '[1,2]'});
});
it('will trigger that a message has been deleted when it is done deleting', function() {
@@ -60,18 +60,18 @@ describeComponent('services/mail_service', function () {
it('fetches a single email', function () {
var me = {};
- var spyAjax = spyOn($, 'ajax').andReturn({done: function(f) { f(email1); return {fail: function() {}};}});
+ var spyAjax = spyOn($, 'ajax').and.returnValue({done: function(f) { f(email1); return {fail: function() {}};}});
var mailHereEvent = spyOnEvent(me, Pixelated.events.mail.here);
this.component.trigger(Pixelated.events.mail.want, { caller: me, mail: email1.ident });
expect(mailHereEvent).toHaveBeenTriggeredOn(me);
- expect(spyAjax.mostRecentCall.args[0]).toEqual('/mail/' + email1.ident);
+ expect(spyAjax.calls.mostRecent().args[0]).toEqual('/mail/' + email1.ident);
});
it('answers mail:notFound if mail returned from server is null', function () {
var me = {};
- var spyAjax = spyOn($, 'ajax').andReturn({done: function(f) { f(null); return {fail: function() {}};}});
+ var spyAjax = spyOn($, 'ajax').and.returnValue({done: function(f) { f(null); return {fail: function() {}};}});
var mailNotFound = spyOnEvent(me, Pixelated.events.mail.notFound);
this.component.trigger(Pixelated.events.mail.want, { caller: me, mail: email1.ident });
@@ -82,7 +82,7 @@ describeComponent('services/mail_service', function () {
it('updates the tags of the desired message', function () {
spyOn(this.component, 'refreshResults');
var updateTagsReturnValue = { tags: ['website'], mailbox: 'inbox'}
- var spyAjax = spyOn($, 'ajax').andReturn({done: function(f) { f(updateTagsReturnValue); return {fail: function() {}};}});
+ var spyAjax = spyOn($, 'ajax').and.returnValue({done: function(f) { f(updateTagsReturnValue); return {fail: function() {}};}});
var spyEvent = spyOnEvent(document, Pixelated.events.mail.tags.updated);
var component = jasmine.createSpyObj('component',['successUpdateTags']);
@@ -91,13 +91,13 @@ describeComponent('services/mail_service', function () {
this.component.trigger(Pixelated.events.mail.tags.update, { ident: email1.ident, tags: email1.tags });
expect(spyEvent).toHaveBeenTriggeredOn(document);
- expect(spyAjax.calls[0].args[0]).toEqual('/mail/1/tags');
- expect(spyAjax.calls[0].args[1].data).toEqual(JSON.stringify({ newtags: email1.tags } ));
+ expect(spyAjax.calls.all()[0].args[0]).toEqual('/mail/1/tags');
+ expect(spyAjax.calls.all()[0].args[1].data).toEqual(JSON.stringify({ newtags: email1.tags } ));
expect(this.component.refreshResults).toHaveBeenCalled();
});
it('triggers an error message when it can\'t update the tags', function () {
- var spyAjax = spyOn($, 'ajax').andReturn({done: function() { return {fail: function(f) {f({status:500});}};}});
+ var spyAjax = spyOn($, 'ajax').and.returnValue({done: function() { return {fail: function(f) {f({status:500});}};}});
var spyEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
var component = jasmine.createSpyObj('component',['failureUpdateTags']);
@@ -105,16 +105,16 @@ describeComponent('services/mail_service', function () {
this.component.trigger(Pixelated.events.mail.tags.update, { ident: email1.ident, tags: email1.tags });
expect(spyEvent).toHaveBeenTriggeredOn(document);
- expect(spyAjax.mostRecentCall.args[0]).toEqual('/mail/1/tags');
- expect(spyAjax.mostRecentCall.args[1].data).toEqual(JSON.stringify({ newtags: email1.tags } ));
+ expect(spyAjax.calls.mostRecent().args[0]).toEqual('/mail/1/tags');
+ expect(spyAjax.calls.mostRecent().args[1].data).toEqual(JSON.stringify({ newtags: email1.tags } ));
});
it('will try to delete a message when requested to', function() {
- var spyAjax = spyOn($, 'ajax').andReturn({done: function() { return {fail: function(f) {}};}});
+ var spyAjax = spyOn($, 'ajax').and.returnValue({done: function() { return {fail: function(f) {}};}});
this.component.trigger(Pixelated.events.mail.delete, {mail: {ident: '43'}});
expect(spyAjax).toHaveBeenCalled();
- expect(spyAjax.mostRecentCall.args[0]).toEqual('/mail/43');
- expect(spyAjax.mostRecentCall.args[1].type).toEqual('DELETE');
+ expect(spyAjax.calls.mostRecent().args[0]).toEqual('/mail/43');
+ expect(spyAjax.calls.mostRecent().args[1].type).toEqual('DELETE');
});
describe('when successfuly deletes an email', function () {
@@ -155,7 +155,7 @@ describeComponent('services/mail_service', function () {
});
it('will trigger an error message when a message cannot be deleted', function() {
- spyOn($, 'ajax').andReturn({done: function() { return {fail: function(f) { f(); }};}});
+ spyOn($, 'ajax').and.returnValue({done: function() { return {fail: function(f) { f(); }};}});
var spyEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
this.component.trigger(Pixelated.events.mail.delete, {mail: {ident: '43'}});
@@ -167,7 +167,7 @@ describeComponent('services/mail_service', function () {
var g;
var eventSpy = spyOnEvent(document, Pixelated.events.mails.available);
- spyOn($, 'ajax').andReturn({done: function(f) { g = f; return {fail: function(){}};}});
+ spyOn($, 'ajax').and.returnValue({done: function(f) { g = f; return {fail: function(){}};}});
this.component.trigger(Pixelated.events.ui.mails.fetchByTag, {tag: 'inbox'});
g({stats: {}, mails: [email1]});
@@ -177,11 +177,11 @@ describeComponent('services/mail_service', function () {
});
it('wraps the tag in quotes before fetching by tag (to support tags with spaces)', function () {
- spyOn($, 'ajax').andReturn({done: function(f) { return {fail: function(){}};}});
+ spyOn($, 'ajax').and.returnValue({done: function(f) { return {fail: function(){}};}});
this.component.trigger(Pixelated.events.ui.mails.fetchByTag, {tag: 'new tag'});
- expect($.ajax.mostRecentCall.args[0]).toContain(encodeURI('tag:"new tag"'));
+ expect($.ajax.calls.mostRecent().args[0]).toContain(encodeURI('tag:"new tag"'));
});
it('sends the previous tag when mails:refresh is called without a tag (this happens when the refresher calls it)', function () {
@@ -189,7 +189,7 @@ describeComponent('services/mail_service', function () {
var eventSpy = spyOnEvent(document, Pixelated.events.mails.availableForRefresh);
this.component.attr.currentTag = 'sent';
- spyOn($, 'ajax').andReturn({done: function(f) { g = f; return {fail: function(){}};}});
+ spyOn($, 'ajax').and.returnValue({done: function(f) { g = f; return {fail: function(){}};}});
this.component.trigger(Pixelated.events.ui.mails.refresh);
g({stats: {}, mails: [email1]});
@@ -203,11 +203,11 @@ describeComponent('services/mail_service', function () {
beforeEach(function () {
pageChangedEvent = spyOnEvent(document, Pixelated.events.ui.page.changed);
- spyOn($, 'ajax').andReturn({done: function(f) {
+ spyOn($, 'ajax').and.returnValue({done: function(f) {
g = f;
return {fail: function(){}};
}});
- spyOn(this.component, 'fetchMail').andCallThrough();
+ spyOn(this.component, 'fetchMail').and.callThrough();
});
it('changes to the previous page and refetch email when ui:page:previous is fired', function() {
diff --git a/web-ui/test/spec/tags/data/tags.spec.js b/web-ui/test/spec/tags/data/tags.spec.js
index 41821366..e42a7752 100644
--- a/web-ui/test/spec/tags/data/tags.spec.js
+++ b/web-ui/test/spec/tags/data/tags.spec.js
@@ -4,20 +4,20 @@ describeComponent('tags/data/tags', function () {
'use strict';
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
});
it('asks the server for tags when receiving the tags:want event', function() {
- spyOn($, 'ajax').andReturn({done: function() {}});
+ spyOn($, 'ajax').and.returnValue({done: function() {}});
this.component.trigger(Pixelated.events.tags.want);
- expect($.ajax.mostRecentCall.args[0]).toEqual('/tags');
+ expect($.ajax.calls.mostRecent().args[0]).toEqual('/tags');
});
it('triggers an event on the initial sender after receiving tags', function() {
var f;
- spyOn($, 'ajax').andReturn({done: function(d) { f = d; }});
+ spyOn($, 'ajax').and.returnValue({done: function(d) { f = d; }});
var me = {};
var eventSpy = spyOnEvent(me, Pixelated.events.tags.received);
@@ -29,13 +29,13 @@ describeComponent('tags/data/tags', function () {
it('triggers an event containing the returned tags', function() {
var f;
- spyOn($, 'ajax').andReturn({done: function(d) { f = d; }});
+ spyOn($, 'ajax').and.returnValue({done: function(d) { f = d; }});
var me = {};
var eventSpy = spyOnEvent(me, Pixelated.events.tags.received);
this.component.trigger(Pixelated.events.tags.want, { caller: me });
var tags = ['foo', 'bar', 'quux/bar'];
f(tags);
tags.push(this.component.all);
- expect(eventSpy.mostRecentCall.data).toEqual({tags: tags});
+ expect(eventSpy.mostRecentCall.data).toEqual(jasmine.objectContaining({tags: tags}));
});
});
diff --git a/web-ui/test/spec/tags/ui/tag.spec.js b/web-ui/test/spec/tags/ui/tag.spec.js
index 48f761da..1f76ebe3 100644
--- a/web-ui/test/spec/tags/ui/tag.spec.js
+++ b/web-ui/test/spec/tags/ui/tag.spec.js
@@ -6,7 +6,7 @@ describeComponent('tags/ui/tag', function () {
describe('inbox tag', function () {
beforeEach(function () {
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
tag: {
name: 'inbox',
ident: '1',
@@ -48,7 +48,7 @@ describeComponent('tags/ui/tag', function () {
describe('increasing count read when email is read', function () {
it('doesnt update if mail.tags or mail.mailbox dont match the tag name', function () {
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
tag: { name: 'sometag', ident: '1', counts: { total: 100, read: 0 } }
});
@@ -65,7 +65,7 @@ describeComponent('tags/ui/tag', function () {
});
it('looks at the mail tags for non default tags', function () {
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
tag: { name: 'tag', ident: '1', counts: { total: 100, read: 0 } }
});
@@ -101,7 +101,7 @@ describeComponent('tags/ui/tag', function () {
describe('drafts tag', function () {
var containerFordrafts;
beforeEach(function () {
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
tag: {
name: 'drafts',
ident: '42',
@@ -122,7 +122,7 @@ describeComponent('tags/ui/tag', function () {
describe('all tag', function () {
beforeEach(function () {
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
tag: {
name: 'all',
ident: '45',
@@ -156,7 +156,7 @@ describeComponent('tags/ui/tag', function () {
_.each(['sent', 'trash'], function (tag_name) {
describe(tag_name + ' tag', function () {
beforeEach(function () {
- setupComponent('<li></li>', {
+ this.setupComponent('<li></li>', {
tag: {
name: tag_name,
ident: '42',
diff --git a/web-ui/test/spec/tags/ui/tag_list.spec.js b/web-ui/test/spec/tags/ui/tag_list.spec.js
index c79bed53..72667b40 100644
--- a/web-ui/test/spec/tags/ui/tag_list.spec.js
+++ b/web-ui/test/spec/tags/ui/tag_list.spec.js
@@ -14,7 +14,7 @@ describeComponent('tags/ui/tag_list', function () {
describe('post initialization', function () {
beforeEach(function () {
- setupComponent();
+ this.setupComponent();
tagsShortcutsContainer = $('<ul>', { id: 'tags-shortcuts' });
$('body').append(tagsShortcutsContainer);
});
@@ -74,7 +74,7 @@ describeComponent('tags/ui/tag_list', function () {
$(document).trigger(Pixelated.events.ui.tagList.load, {tags: [] });
- expect(tagsLoadedEvent).toHaveBeenTriggeredOnAndWith(document, { tag: undefined });
+ expect(tagsLoadedEvent).toHaveBeenTriggeredOnAndWith(document, jasmine.objectContaining({ tag: undefined }));
});
it('should save the current tag when a tag is selected', function () {
diff --git a/web-ui/test/spec/tags/ui/tag_shortcut.spec.js b/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
index 9164507a..7f015319 100644
--- a/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
+++ b/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
@@ -46,8 +46,8 @@ describeComponent('tags/ui/tag_shortcut', function () {
var shortcutAddedAfterEmptyingParent = TagShortcut.appendedTo(parent, { linkTo: { name: 'inbox', counts: { total: 15 }}, trigger: component });
// by now shorcut is not in the DOM anymore but shortcutAddedAfterEmptyingParent is
- spyOn(shortcut, 'teardown').andCallThrough();
- spyOn(shortcutAddedAfterEmptyingParent, 'teardown').andCallThrough();
+ spyOn(shortcut, 'teardown').and.callThrough();
+ spyOn(shortcutAddedAfterEmptyingParent, 'teardown').and.callThrough();
$(document).trigger(Pixelated.events.tags.shortcuts.teardown);
diff --git a/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js b/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
index 04d0e9d4..5b25b5fb 100644
--- a/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
+++ b/web-ui/test/spec/user_alerts/ui/user_alerts.spec.js
@@ -4,7 +4,7 @@ describeComponent('user_alerts/ui/user_alerts', function () {
'use strict';
beforeEach(function () {
- setupComponent('<div id="userAlerts"></div>', { dismissTimeout: 100 });
+ this.setupComponent('<div id="userAlerts"></div>', { dismissTimeout: 100 });
});
it('should render message when ui:user_alerts:displayMessage is triggered', function () {