diff options
author | Caio Carrara <ccarrara@thoughtworks.com> | 2016-06-24 17:15:54 -0300 |
---|---|---|
committer | Caio Carrara <ccarrara@thoughtworks.com> | 2016-06-27 16:39:55 -0300 |
commit | 361796f0ff1eb0f450f768749d5c69f5c4f6b1e4 (patch) | |
tree | 01e1729ce21feccba9c08fd6e7d8452397d5521a /web-ui/test/spec | |
parent | 6042a2b1b93d2f2a89c418971d7e12b5a79b3314 (diff) |
Updates the i18next to latest version
See: #727
Diffstat (limited to 'web-ui/test/spec')
8 files changed, 28 insertions, 23 deletions
diff --git a/web-ui/test/spec/helpers/browser.spec.js b/web-ui/test/spec/helpers/browser.spec.js index 5b740da8..0c981a70 100644 --- a/web-ui/test/spec/helpers/browser.spec.js +++ b/web-ui/test/spec/helpers/browser.spec.js @@ -5,7 +5,6 @@ define(['helpers/browser'], function (browser) { it('gets cookie', function() { document.cookie = 'TWISTED_SESSION=ff895ffc45a4ce140bfc5dda6c61d232; i18next=en-us'; expect(browser.getCookie('TWISTED_SESSION')).toEqual('ff895ffc45a4ce140bfc5dda6c61d232'); - expect(browser.getCookie('i18next')).toEqual('en-us'); }); }); diff --git a/web-ui/test/spec/mail_list_actions/ui/mail_list_actions.spec.js b/web-ui/test/spec/mail_list_actions/ui/mail_list_actions.spec.js index a12ca98a..1ab90562 100644 --- a/web-ui/test/spec/mail_list_actions/ui/mail_list_actions.spec.js +++ b/web-ui/test/spec/mail_list_actions/ui/mail_list_actions.spec.js @@ -1,25 +1,25 @@ describeComponent('mail_list_actions/ui/mail_list_actions', function () { 'use strict'; var mailListActionsContainer; - + var i18n; describe('post initialization', function () { beforeEach(function () { this.setupComponent(); + i18n = require('views/i18n'); mailListActionsContainer = $('<input>', { id: 'delete-selected'}); }); it('should render button text', function () { $(document).trigger(Pixelated.events.ui.tag.select, {tag: 'inbox'}); - - expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="Delete" disabled="disabled"></li>'); + + expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="' + i18n.t('Delete') + '" disabled="disabled"></li>'); }); it('should render button text delete permanently if tag trash', function () { $(document).trigger(Pixelated.events.ui.tag.select, {tag: 'trash'}); - - expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="Delete Permanently" disabled="disabled"></li>'); + expect(this.component.$node.html()).toMatch('<li><input type="button" id="delete-selected" value="Delete permanently" disabled="disabled"></li>'); }); - + it('should render button delete permanently if url contains trash tag', function () { var urlParams = require('page/router/url_params'); spyOn(urlParams, 'getTag').and.returnValue('trash'); 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 de6a6b0d..4985f23a 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 @@ -3,9 +3,10 @@ describeComponent('mail_view/ui/forward_box', function () { var attrs; var testMail; + var i18n; beforeEach(function () { testMail = Pixelated.testData().parsedMail.simpleTextPlain; - + i18n = require('views/i18n'); Pixelated.mockBloodhound(); }); @@ -13,7 +14,7 @@ describeComponent('mail_view/ui/forward_box', function () { testMail.header.subject = 'Very interesting'; this.setupComponent({ mail: testMail }); - expect(this.component.select('subjectDisplay').text()).toEqual('Fwd: '+ testMail.header.subject); + expect(this.component.select('subjectDisplay').text()).toEqual(i18n.t('fwd') + testMail.header.subject); }); it('should have no recipients', 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 731d57b3..896fdde3 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 @@ -13,7 +13,7 @@ describeComponent('mail_view/ui/reply_box', function () { describe('reply compose box', function() { it('should display subject of the reply', function() { - expect(this.component.select('subjectDisplay').text()).toBe(i18n('Re: ') + attrs.mail.header.subject); + expect(this.component.select('subjectDisplay').text()).toBe(i18n.t('re') + attrs.mail.header.subject); }); it('should show recipient fields when clicking on recipient display', function() { @@ -43,7 +43,7 @@ describeComponent('mail_view/ui/reply_box', function () { this.setupComponent(attrs); - expect(this.component.select('subjectDisplay').text()).toEqual(i18n('Re: ')+ attrs.mail.header.subject); + expect(this.component.select('subjectDisplay').text()).toEqual(i18n.t('re')+ attrs.mail.header.subject); }); it('should use set In-Reply-To header when Message-Id header is set', 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 480fe7a8..05fce52c 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 @@ -2,6 +2,11 @@ describeComponent('mail_view/ui/send_button', function () { 'use strict'; + var i18n; + beforeEach(function () { + i18n = require('views/i18n'); + }); + describe('send button', function () { beforeEach(function () { this.setupComponent('<button></button>'); @@ -29,7 +34,7 @@ describeComponent('mail_view/ui/send_button', function () { $(document).trigger(Pixelated.events.ui.recipients.updated, { newRecipients: ['InvalidEmail']}); expect(this.$node).not.toBeDisabled(); - expect(this.$node.text()).toBe('Send'); + expect(this.$node.text()).toBe(i18n.t('send-button')); }); }); @@ -82,22 +87,22 @@ describeComponent('mail_view/ui/send_button', function () { }); it('disables the button after clicking', function () { - expect(this.$node.text()).toBe('Send'); + expect(this.$node.text()).toBe(i18n.t('send-button')); this.$node.click(); - expect(this.$node.text()).toBe('Sending...'); + expect(this.$node.text()).toBe(i18n.t('sending-mail')); expect(this.$node.prop('disabled')).toBeTruthy(); }); it('enables again if sending errors out', function() { - expect(this.$node.text()).toBe('Send'); + expect(this.$node.text()).toBe(i18n.t('send-button')); this.$node.click(); $(document).trigger(Pixelated.events.mail.send_failed); - expect(this.$node.text()).toBe('Send'); + expect(this.$node.text()).toBe(i18n.t('send-button')); expect(this.$node.prop('disabled')).not.toBeTruthy(); }); diff --git a/web-ui/test/spec/services/delete_service.spec.js b/web-ui/test/spec/services/delete_service.spec.js index 9872a644..f98a33a8 100644 --- a/web-ui/test/spec/services/delete_service.spec.js +++ b/web-ui/test/spec/services/delete_service.spec.js @@ -28,7 +28,7 @@ describeComponent('services/delete_service', function () { var expectedDeleteEventData = { mail: mailWithoutTrashTag, - successMessage: i18n('Your message was moved to trash!') + successMessage: i18n.t('Your message was moved to trash!') }; expect(mailDeleteEvent).toHaveBeenTriggeredOnAndWith(document, expectedDeleteEventData); @@ -42,7 +42,7 @@ describeComponent('services/delete_service', function () { var expectedDeleteEventData = { mail: mailWithTrashTag, - successMessage: i18n('Your message was permanently deleted!') + successMessage: i18n.t('Your message was permanently deleted!') }; expect(mailDeleteEvent).toHaveBeenTriggeredOnAndWith(document, expectedDeleteEventData ); diff --git a/web-ui/test/spec/services/mail_service.spec.js b/web-ui/test/spec/services/mail_service.spec.js index 82714797..2d22d1cf 100644 --- a/web-ui/test/spec/services/mail_service.spec.js +++ b/web-ui/test/spec/services/mail_service.spec.js @@ -167,7 +167,7 @@ describeComponent('services/mail_service', function () { deferred.reject({mailsJSON: {}}); - expect(spyEvent).toHaveBeenTriggeredOnAndWith(document, {message: i18n('Could not delete email')} ); + expect(spyEvent).toHaveBeenTriggeredOnAndWith(document, {message: i18n.t('Could not delete email')} ); }); it('will try to recover a message when requested to', function() { @@ -202,11 +202,11 @@ describeComponent('services/mail_service', function () { spyOn(this.component, 'errorMessage'); this.component.trigger(Pixelated.events.mail.archiveMany, mails); - + deferred.reject({}); - expect(this.component.errorMessage).toHaveBeenCalledWith(i18n('Could not archive emails')); + expect(this.component.errorMessage).toHaveBeenCalledWith(i18n.t('Could not archive emails')); }); - + it('make an ajax request to /mails/archive', function() { this.component.trigger(Pixelated.events.mail.archiveMany, {checkedMails: [{ident: '43'}, {ident: '44'}]}); diff --git a/web-ui/test/spec/services/recover_service.spec.js b/web-ui/test/spec/services/recover_service.spec.js index 86fe9f87..16dc26f4 100644 --- a/web-ui/test/spec/services/recover_service.spec.js +++ b/web-ui/test/spec/services/recover_service.spec.js @@ -24,7 +24,7 @@ describeComponent('services/recover_service', function () { var expectedRecoverManyEventData = { mails: [mail1, mail2], - successMessage: i18n('Your messages were moved to inbox!') + successMessage: i18n.t('Your messages were moved to inbox!') }; expect(mailRecoverManyEvent).toHaveBeenTriggeredOnAndWith(document, expectedRecoverManyEventData); |