From 495bc391e140cc2bb462c81fa90410a0fe8f6a4c Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Mon, 20 Oct 2014 12:17:18 +0200 Subject: massive update of bower and npm libs - includes flight, jasmine and a bunch of stuff. If things get weird when developing, remove you bower_components and your node_modules and install it again --- .../mail_list/ui/mail_items/generic_mail_item.js | 2 +- web-ui/app/js/mail_list/ui/mail_items/mail_item.js | 10 ++--- web-ui/app/js/mail_view/ui/recipients/recipient.js | 4 +- .../app/js/mail_view/ui/recipients/recipients.js | 2 +- .../mail_view/ui/recipients/recipients_iterator.js | 10 ++--- web-ui/bower.json | 26 +++++------ web-ui/package.json | 3 +- .../spec/dispatchers/left_pane_dispatcher.spec.js | 4 +- .../dispatchers/middle_pane_dispatchers.spec.js | 2 +- .../spec/dispatchers/right_pane_dispatcher.spec.js | 4 +- web-ui/test/spec/helpers/view_helper.spec.js | 2 +- .../ui/mail_items/generic_mail_item.spec.js | 2 +- .../spec/mail_list/ui/mail_items/mail_item.spec.js | 2 +- web-ui/test/spec/mail_list/ui/mail_list.spec.js | 2 +- .../mail_list_actions/ui/compose_trigger.spec.js | 2 +- .../spec/mail_list_actions/ui/mail_actions.spec.js | 9 ---- .../ui/pagination_trigger.spec.js | 2 +- .../test/spec/mail_view/data/mail_sender.spec.js | 26 +++++------ web-ui/test/spec/mail_view/ui/compose_box.spec.js | 2 +- web-ui/test/spec/mail_view/ui/draft_box.spec.js | 8 ++-- .../spec/mail_view/ui/draft_save_status.spec.js | 2 +- web-ui/test/spec/mail_view/ui/forward_box.spec.js | 20 ++++----- web-ui/test/spec/mail_view/ui/mail_actions.spec.js | 5 +-- web-ui/test/spec/mail_view/ui/mail_view.spec.js | 12 +++--- .../mail_view/ui/recipients/recipients.spec.js | 6 +-- .../ui/recipients/recipients_input.spec.js | 4 +- .../ui/recipients/recipients_iterator.spec.js | 2 +- web-ui/test/spec/mail_view/ui/reply_box.spec.js | 14 +++--- .../test/spec/mail_view/ui/reply_section.spec.js | 2 +- web-ui/test/spec/mail_view/ui/send_button.spec.js | 2 +- .../test/spec/mixins/with_mail_edit_base.spec.js | 32 +++++++------- web-ui/test/spec/page/logout.spec.js | 8 ++-- web-ui/test/spec/page/pane_contract_expand.spec.js | 4 +- web-ui/test/spec/page/router.spec.js | 6 +-- web-ui/test/spec/search/search_trigger.spec.js | 2 +- web-ui/test/spec/services/delete_service.spec.js | 2 +- web-ui/test/spec/services/mail_service.spec.js | 50 +++++++++++----------- web-ui/test/spec/tags/data/tags.spec.js | 12 +++--- web-ui/test/spec/tags/ui/tag.spec.js | 12 +++--- web-ui/test/spec/tags/ui/tag_list.spec.js | 4 +- web-ui/test/spec/tags/ui/tag_shortcut.spec.js | 4 +- .../test/spec/user_alerts/ui/user_alerts.spec.js | 2 +- 42 files changed, 160 insertions(+), 171 deletions(-) delete mode 100644 web-ui/test/spec/mail_list_actions/ui/mail_actions.spec.js (limited to 'web-ui') 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('
'); + this.setupComponent('
'); }); 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('
  • ', { + this.setupComponent('
  • ', { 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('
  • ', { + this.setupComponent('
  • ', { 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('
    ', { + this.setupComponent('
    ', { 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('
    '); + this.setupComponent('
    '); }); 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('
    '); + this.setupComponent('
    '); }); 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: ', 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('
    ', {mail: mail}); + this.setupComponent('
    ', {mail: mail}); }); it('triggers mail:want on ui:openMail', function () { var spyEvent = spyOnEvent(document, Pixelated.events.mail.want); - setupComponent('
    ', {ident: mail.ident }); + this.setupComponent('
    ', {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: ', 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('