From 1849dc115803187371fcb5bd697be29e2a0b7239 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 8 Apr 2016 16:00:16 +0100 Subject: [PATCH] deps: ember-suave@2.0.1 no issue - https://github.com/DockYard/ember-suave/releases/tag/v2.0.0 - fix linting errors arising from new rules --- .../app/initializers/trailing-history.js | 2 +- core/client/app/mixins/404-handler.js | 2 +- core/client/app/models/user.js | 2 +- core/client/app/utils/document-title.js | 2 +- core/client/package.json | 2 +- core/client/tests/acceptance/team-test.js | 16 ++--- .../tests/helpers/module-for-acceptance.js | 4 +- .../unit/controllers/settings/general-test.js | 4 +- .../tests/unit/helpers/is-equal-test.js | 2 +- core/client/tests/unit/models/role-test.js | 2 +- .../client/tests/unit/services/config-test.js | 4 +- .../tests/unit/services/notifications-test.js | 64 +++++++++---------- .../tests/unit/utils/ghost-paths-test.js | 2 +- .../unit/validators/tag-settings-test.js | 28 ++++---- 14 files changed, 68 insertions(+), 68 deletions(-) diff --git a/core/client/app/initializers/trailing-history.js b/core/client/app/initializers/trailing-history.js index e20bdf8bb1..d24d9429b2 100644 --- a/core/client/app/initializers/trailing-history.js +++ b/core/client/app/initializers/trailing-history.js @@ -4,7 +4,7 @@ const {HistoryLocation} = Ember; let trailingHistory = HistoryLocation.extend({ formatURL() { - return this._super.apply(this, arguments).replace(/\/?$/, '/'); + return this._super(...arguments).replace(/\/?$/, '/'); } }); diff --git a/core/client/app/mixins/404-handler.js b/core/client/app/mixins/404-handler.js index 600324a057..ef378910b2 100644 --- a/core/client/app/mixins/404-handler.js +++ b/core/client/app/mixins/404-handler.js @@ -10,7 +10,7 @@ export default Ember.Mixin.create({ let router = this.get('router'); let params = []; - for (const key of Object.keys(routeInfo.params)) { + for (let key of Object.keys(routeInfo.params)) { params.push(routeInfo.params[key]); } diff --git a/core/client/app/models/user.js b/core/client/app/models/user.js index 17a97a763f..5b6c98995b 100644 --- a/core/client/app/models/user.js +++ b/core/client/app/models/user.js @@ -59,7 +59,7 @@ export default Model.extend(ValidationEngine, { return ['invited', 'invited-pending'].indexOf(this.get('status')) > -1; }), - pending: equal('status', 'invited-pending').property('status'), + pending: equal('status', 'invited-pending'), passwordValidationErrors: computed('password', 'newPassword', 'ne2Password', function () { let validationErrors = []; diff --git a/core/client/app/utils/document-title.js b/core/client/app/utils/document-title.js index bd9c9b975c..504c6dd29b 100644 --- a/core/client/app/utils/document-title.js +++ b/core/client/app/utils/document-title.js @@ -26,7 +26,7 @@ export default function () { } if (isArray(titleToken)) { - tokens.unshift.apply(this, titleToken); + tokens.unshift(...titleToken); } else if (titleToken) { tokens.unshift(titleToken); } diff --git a/core/client/package.json b/core/client/package.json index 53db696aba..e106507286 100644 --- a/core/client/package.json +++ b/core/client/package.json @@ -47,7 +47,7 @@ "ember-simple-auth": "1.0.1", "ember-sinon": "0.5.0", "ember-sortable": "1.7.0", - "ember-suave": "1.2.3", + "ember-suave": "2.0.1", "ember-watson": "0.7.0", "fs-extra": "0.16.3", "glob": "^4.0.5", diff --git a/core/client/tests/acceptance/team-test.js b/core/client/tests/acceptance/team-test.js index 3bbaba8a3d..f161d0c7d0 100644 --- a/core/client/tests/acceptance/team-test.js +++ b/core/client/tests/acceptance/team-test.js @@ -34,8 +34,8 @@ describe('Acceptance: Team', function () { }); it('redirects correctly when authenticated as author', function () { - const role = server.create('role', {name: 'Author'}); - const user = server.create('user', {roles: [role], slug: 'test-user'}); + let role = server.create('role', {name: 'Author'}); + let user = server.create('user', {roles: [role], slug: 'test-user'}); server.create('user', {slug: 'no-access'}); @@ -48,8 +48,8 @@ describe('Acceptance: Team', function () { }); it('redirects correctly when authenticated as editor', function () { - const role = server.create('role', {name: 'Editor'}); - const user = server.create('user', {roles: [role], slug: 'test-user'}); + let role = server.create('role', {name: 'Editor'}); + let user = server.create('user', {roles: [role], slug: 'test-user'}); server.create('user', {slug: 'no-access'}); @@ -63,8 +63,8 @@ describe('Acceptance: Team', function () { describe('when logged in', function () { beforeEach(function () { - const role = server.create('role', {name: 'Admininstrator'}); - const user = server.create('user', {roles: [role]}); + let role = server.create('role', {name: 'Admininstrator'}); + let user = server.create('user', {roles: [role]}); server.loadFixtures(); @@ -72,8 +72,8 @@ describe('Acceptance: Team', function () { }); it('it renders and navigates correctly', function () { - const user1 = server.create('user'); - const user2 = server.create('user'); + let user1 = server.create('user'); + let user2 = server.create('user'); visit('/team'); diff --git a/core/client/tests/helpers/module-for-acceptance.js b/core/client/tests/helpers/module-for-acceptance.js index 67abb91135..d9d22b6958 100644 --- a/core/client/tests/helpers/module-for-acceptance.js +++ b/core/client/tests/helpers/module-for-acceptance.js @@ -8,13 +8,13 @@ export default function (name, options = {}) { this.application = startApp(); if (options.beforeEach) { - options.beforeEach.apply(this, arguments); + options.beforeEach(...arguments); } }, afterEach() { if (options.afterEach) { - options.afterEach.apply(this, arguments); + options.afterEach(...arguments); } destroyApp(this.application); diff --git a/core/client/tests/unit/controllers/settings/general-test.js b/core/client/tests/unit/controllers/settings/general-test.js index daeeb0265c..763b0f9fc5 100644 --- a/core/client/tests/unit/controllers/settings/general-test.js +++ b/core/client/tests/unit/controllers/settings/general-test.js @@ -15,7 +15,7 @@ describeModule( function () { it('isDatedPermalinks should be correct', function () { - const controller = this.subject({ + let controller = this.subject({ model: Ember.Object.create({ permalinks: '/:year/:month/:day/:slug/' }) @@ -31,7 +31,7 @@ describeModule( }); it('setting isDatedPermalinks should switch between dated and slug', function () { - const controller = this.subject({ + let controller = this.subject({ model: Ember.Object.create({ permalinks: '/:year/:month/:day/:slug/' }) diff --git a/core/client/tests/unit/helpers/is-equal-test.js b/core/client/tests/unit/helpers/is-equal-test.js index a0254c7d9a..d7cffefa8d 100644 --- a/core/client/tests/unit/helpers/is-equal-test.js +++ b/core/client/tests/unit/helpers/is-equal-test.js @@ -11,7 +11,7 @@ import { describe('Unit: Helper: is-equal', function () { // Replace this with your real tests. it('works', function () { - const result = isEqual([42, 42]); + let result = isEqual([42, 42]); expect(result).to.be.ok; }); diff --git a/core/client/tests/unit/models/role-test.js b/core/client/tests/unit/models/role-test.js index 0b95009f69..4305257889 100644 --- a/core/client/tests/unit/models/role-test.js +++ b/core/client/tests/unit/models/role-test.js @@ -8,7 +8,7 @@ const {run} = Ember; describeModel('role', 'Unit: Model: role', function () { it('provides a lowercase version of the name', function () { - const model = this.subject({ + let model = this.subject({ name: 'Author' }); diff --git a/core/client/tests/unit/services/config-test.js b/core/client/tests/unit/services/config-test.js index 936f7aad58..47a7104d52 100644 --- a/core/client/tests/unit/services/config-test.js +++ b/core/client/tests/unit/services/config-test.js @@ -17,7 +17,7 @@ describeModule( function () { // Replace this with your real tests. it('exists', function () { - const service = this.subject(); + let service = this.subject(); expect(service).to.be.ok; }); @@ -26,7 +26,7 @@ describeModule( .attr('content', '23e435234423') .appendTo('head'); - const service = this.subject(); + let service = this.subject(); expect(service.get('clientSecret')).to.equal('23e435234423'); }); diff --git a/core/client/tests/unit/services/notifications-test.js b/core/client/tests/unit/services/notifications-test.js index 4440430d74..caebbc7708 100644 --- a/core/client/tests/unit/services/notifications-test.js +++ b/core/client/tests/unit/services/notifications-test.js @@ -25,7 +25,7 @@ describeModule( }); it('filters alerts/notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); // wrapped in run-loop to enure alerts/notifications CPs are updated run(() => { @@ -41,7 +41,7 @@ describeModule( }); it('#handleNotification deals with DS.Notification notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); let notification = Ember.Object.create({message: '

Test

', status: 'alert'}); notification.toJSON = function () {}; @@ -55,7 +55,7 @@ describeModule( }); it('#handleNotification defaults to notification if no status supplied', function () { - const notifications = this.subject(); + let notifications = this.subject(); notifications.handleNotification({message: 'Test'}, false); @@ -64,7 +64,7 @@ describeModule( }); it('#showAlert adds POJO alerts', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showAlert('Test Alert', {type: 'error'}); @@ -75,7 +75,7 @@ describeModule( }); it('#showAlert adds delayed notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showNotification('Test Alert', {type: 'error', delayed: true}); @@ -89,7 +89,7 @@ describeModule( // we split on the second period and treat the resulting base as // the key for duplicate checking it('#showAlert clears duplicates', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showAlert('Kept'); @@ -107,7 +107,7 @@ describeModule( }); it('#showNotification adds POJO notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showNotification('Test Notification', {type: 'success'}); @@ -118,7 +118,7 @@ describeModule( }); it('#showNotification adds delayed notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showNotification('Test Notification', {delayed: true}); @@ -129,7 +129,7 @@ describeModule( }); it('#showNotification clears existing notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showNotification('First'); @@ -142,7 +142,7 @@ describeModule( }); it('#showNotification keeps existing notifications if doNotCloseNotifications option passed', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showNotification('First'); @@ -154,7 +154,7 @@ describeModule( // TODO: review whether this can be removed once it's no longer used by validations it('#showErrors adds multiple notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showErrors([ @@ -170,8 +170,8 @@ describeModule( }); it('#showAPIError adds single json response error', function () { - const notifications = this.subject(); - const error = new AjaxError('Single error'); + let notifications = this.subject(); + let error = new AjaxError('Single error'); run(() => { notifications.showAPIError(error); @@ -186,8 +186,8 @@ describeModule( // used to display validation errors returned from the server it('#showAPIError adds multiple json response errors', function () { - const notifications = this.subject(); - const error = new AjaxError(['First error', 'Second error']); + let notifications = this.subject(); + let error = new AjaxError(['First error', 'Second error']); run(() => { notifications.showAPIError(error); @@ -200,8 +200,8 @@ describeModule( }); it('#showAPIError displays default error text if response has no error/message', function () { - const notifications = this.subject(); - const resp = false; + let notifications = this.subject(); + let resp = false; run(() => { notifications.showAPIError(resp); }); @@ -220,7 +220,7 @@ describeModule( }); it('#showAPIError sets correct key when passed a base key', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showAPIError('Test', {key: 'test.alert'}); @@ -230,7 +230,7 @@ describeModule( }); it('#showAPIError sets correct key when not passed a key', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showAPIError('Test'); @@ -240,8 +240,8 @@ describeModule( }); it('#showAPIError parses errors from ember-ajax correctly', function () { - const notifications = this.subject(); - const error = new InvalidError('Test Error'); + let notifications = this.subject(); + let error = new InvalidError('Test Error'); run(() => { notifications.showAPIError(error); @@ -255,7 +255,7 @@ describeModule( }); it('#displayDelayed moves delayed notifications into content', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showNotification('First', {delayed: true}); @@ -272,8 +272,8 @@ describeModule( }); it('#closeNotification removes POJO notifications', function () { - const notification = {message: 'Close test', status: 'notification'}; - const notifications = this.subject(); + let notification = {message: 'Close test', status: 'notification'}; + let notifications = this.subject(); run(() => { notifications.handleNotification(notification); @@ -291,8 +291,8 @@ describeModule( }); it('#closeNotification removes and deletes DS.Notification records', function () { - const notification = Ember.Object.create({message: 'Close test', status: 'alert'}); - const notifications = this.subject(); + let notification = Ember.Object.create({message: 'Close test', status: 'alert'}); + let notifications = this.subject(); notification.toJSON = function () {}; notification.deleteRecord = function () {}; @@ -319,7 +319,7 @@ describeModule( }); it('#closeNotifications only removes notifications', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showAlert('First alert'); @@ -337,7 +337,7 @@ describeModule( }); it('#closeNotifications only closes notifications with specified key', function () { - const notifications = this.subject(); + let notifications = this.subject(); run(() => { notifications.showAlert('First alert'); @@ -359,8 +359,8 @@ describeModule( }); it('#clearAll removes everything without deletion', function () { - const notifications = this.subject(); - const notificationModel = Ember.Object.create({message: 'model'}); + let notifications = this.subject(); + let notificationModel = Ember.Object.create({message: 'model'}); notificationModel.toJSON = function () {}; notificationModel.deleteRecord = function () {}; @@ -385,7 +385,7 @@ describeModule( }); it('#closeAlerts only removes alerts', function () { - const notifications = this.subject(); + let notifications = this.subject(); notifications.showNotification('First notification'); notifications.showAlert('First alert'); @@ -400,7 +400,7 @@ describeModule( }); it('#closeAlerts closes only alerts with specified key', function () { - const notifications = this.subject(); + let notifications = this.subject(); notifications.showNotification('First notification'); notifications.showAlert('First alert', {key: 'test.close'}); diff --git a/core/client/tests/unit/utils/ghost-paths-test.js b/core/client/tests/unit/utils/ghost-paths-test.js index ffdf0b3d68..a2b4f05de2 100644 --- a/core/client/tests/unit/utils/ghost-paths-test.js +++ b/core/client/tests/unit/utils/ghost-paths-test.js @@ -2,7 +2,7 @@ import ghostPaths from 'ghost/utils/ghost-paths'; describe('Unit: Util: ghost-paths', function () { describe('join', function () { - const {join} = ghostPaths().url; + let {join} = ghostPaths().url; it('should join two or more paths, normalizing slashes', function () { let path; diff --git a/core/client/tests/unit/validators/tag-settings-test.js b/core/client/tests/unit/validators/tag-settings-test.js index 01b26beeed..cc598cba98 100644 --- a/core/client/tests/unit/validators/tag-settings-test.js +++ b/core/client/tests/unit/validators/tag-settings-test.js @@ -29,8 +29,8 @@ const Tag = Ember.Object.extend(ValidationEngine, { describe('Unit: Validator: tag-settings', function () { it('validates all fields by default', function () { - const tag = Tag.create({}); - const properties = tag.get('validators.tag.properties'); + let tag = Tag.create({}); + let properties = tag.get('validators.tag.properties'); // TODO: This is checking implementation details rather than expected // behaviour. Replace once we have consistent behaviour (see below) @@ -56,7 +56,7 @@ describe('Unit: Validator: tag-settings', function () { it('passes with valid name', function () { // longest valid name - const tag = Tag.create({name: (new Array(151).join('x'))}); + let tag = Tag.create({name: (new Array(151).join('x'))}); let passed = false; expect(tag.get('name').length, 'name length').to.equal(150); @@ -72,7 +72,7 @@ describe('Unit: Validator: tag-settings', function () { }); it('validates name presence', function () { - const tag = Tag.create(); + let tag = Tag.create(); let passed = false; let nameErrors; @@ -99,7 +99,7 @@ describe('Unit: Validator: tag-settings', function () { }); it('validates names starting with a comma', function () { - const tag = Tag.create({name: ',test'}); + let tag = Tag.create({name: ',test'}); let passed = false; let nameErrors; @@ -119,7 +119,7 @@ describe('Unit: Validator: tag-settings', function () { it('validates name length', function () { // shortest invalid name - const tag = Tag.create({name: (new Array(152).join('x'))}); + let tag = Tag.create({name: (new Array(152).join('x'))}); let passed = false; let nameErrors; @@ -141,7 +141,7 @@ describe('Unit: Validator: tag-settings', function () { it('passes with valid slug', function () { // longest valid slug - const tag = Tag.create({slug: (new Array(151).join('x'))}); + let tag = Tag.create({slug: (new Array(151).join('x'))}); let passed = false; expect(tag.get('slug').length, 'slug length').to.equal(150); @@ -158,7 +158,7 @@ describe('Unit: Validator: tag-settings', function () { it('validates slug length', function () { // shortest invalid slug - const tag = Tag.create({slug: (new Array(152).join('x'))}); + let tag = Tag.create({slug: (new Array(152).join('x'))}); let passed = false; let slugErrors; @@ -180,7 +180,7 @@ describe('Unit: Validator: tag-settings', function () { it('passes with a valid description', function () { // longest valid description - const tag = Tag.create({description: (new Array(201).join('x'))}); + let tag = Tag.create({description: (new Array(201).join('x'))}); let passed = false; expect(tag.get('description').length, 'description length').to.equal(200); @@ -197,7 +197,7 @@ describe('Unit: Validator: tag-settings', function () { it('validates description length', function () { // shortest invalid description - const tag = Tag.create({description: (new Array(202).join('x'))}); + let tag = Tag.create({description: (new Array(202).join('x'))}); let passed = false; let errors; @@ -227,7 +227,7 @@ describe('Unit: Validator: tag-settings', function () { // model/validator respectively - this should be standardised it('passes with a valid metaTitle', function () { // longest valid metaTitle - const tag = Tag.create({metaTitle: (new Array(151).join('x'))}); + let tag = Tag.create({metaTitle: (new Array(151).join('x'))}); let passed = false; expect(tag.get('metaTitle').length, 'metaTitle length').to.equal(150); @@ -244,7 +244,7 @@ describe('Unit: Validator: tag-settings', function () { it('validates metaTitle length', function () { // shortest invalid metaTitle - const tag = Tag.create({metaTitle: (new Array(152).join('x'))}); + let tag = Tag.create({metaTitle: (new Array(152).join('x'))}); let passed = false; let errors; @@ -268,7 +268,7 @@ describe('Unit: Validator: tag-settings', function () { // the model/validator respectively - this should be standardised it('passes with a valid metaDescription', function () { // longest valid description - const tag = Tag.create({metaDescription: (new Array(201).join('x'))}); + let tag = Tag.create({metaDescription: (new Array(201).join('x'))}); let passed = false; expect(tag.get('metaDescription').length, 'metaDescription length').to.equal(200); @@ -285,7 +285,7 @@ describe('Unit: Validator: tag-settings', function () { it('validates metaDescription length', function () { // shortest invalid metaDescription - const tag = Tag.create({metaDescription: (new Array(202).join('x'))}); + let tag = Tag.create({metaDescription: (new Array(202).join('x'))}); let passed = false; let errors;