From dbf7e252b37d5408baf6060ffe97eb1ec69cdd05 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 6 Oct 2020 11:39:41 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20deprecation=20?= =?UTF-8?q?warnings=20from=20ui/core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/account/password/index.hbs | 2 +- .../app/components/form/auth-method/index.hbs | 2 +- .../app/components/form/host-set/index.hbs | 2 +- ui/core/app/components/form/host/index.hbs | 2 +- ui/core/app/components/form/target/index.hbs | 2 +- .../accounts/change-password-test.js | 4 +- .../acceptance/accounts/set-password-test.js | 4 +- ui/core/tests/acceptance/roles/grants-test.js | 16 +++--- .../components/bread-crumbs-test.js | 53 ------------------- 9 files changed, 21 insertions(+), 66 deletions(-) delete mode 100644 ui/core/tests/integration/components/bread-crumbs-test.js diff --git a/ui/core/app/components/form/account/password/index.hbs b/ui/core/app/components/form/account/password/index.hbs index 34b7ed0e4..740ea22a5 100644 --- a/ui/core/app/components/form/account/password/index.hbs +++ b/ui/core/app/components/form/account/password/index.hbs @@ -7,7 +7,7 @@ as |form| > diff --git a/ui/core/app/components/form/auth-method/index.hbs b/ui/core/app/components/form/auth-method/index.hbs index ffa39a264..2704507ec 100644 --- a/ui/core/app/components/form/auth-method/index.hbs +++ b/ui/core/app/components/form/auth-method/index.hbs @@ -7,7 +7,7 @@ as |form| > diff --git a/ui/core/app/components/form/host-set/index.hbs b/ui/core/app/components/form/host-set/index.hbs index 76614834c..d457ad0e7 100644 --- a/ui/core/app/components/form/host-set/index.hbs +++ b/ui/core/app/components/form/host-set/index.hbs @@ -8,7 +8,7 @@ > diff --git a/ui/core/app/components/form/host/index.hbs b/ui/core/app/components/form/host/index.hbs index 796496134..b5a931880 100644 --- a/ui/core/app/components/form/host/index.hbs +++ b/ui/core/app/components/form/host/index.hbs @@ -8,7 +8,7 @@ > diff --git a/ui/core/app/components/form/target/index.hbs b/ui/core/app/components/form/target/index.hbs index 20627adef..afbfc76b0 100644 --- a/ui/core/app/components/form/target/index.hbs +++ b/ui/core/app/components/form/target/index.hbs @@ -8,7 +8,7 @@ > diff --git a/ui/core/tests/acceptance/accounts/change-password-test.js b/ui/core/tests/acceptance/accounts/change-password-test.js index 27a28ba3d..b474be688 100644 --- a/ui/core/tests/acceptance/accounts/change-password-test.js +++ b/ui/core/tests/acceptance/accounts/change-password-test.js @@ -66,10 +66,12 @@ module('Acceptance | accounts | change password', function (hooks) { test('can change password for account', async function (assert) { assert.expect(2); - this.server.post('/accounts/:id', (_, { requestBody }) => { + this.server.post('/accounts/:idMethod', (_, { params: { idMethod }, requestBody }) => { const attrs = JSON.parse(requestBody); assert.equal(attrs.current_password, 'current password', 'current password is provided'); assert.equal(attrs.new_password, 'new password', 'new password is provided'); + const id = idMethod.split(':')[0]; + return { id }; }); await visit(urls.changePassword); await fillIn('[name="currentPassword"]', 'current password'); diff --git a/ui/core/tests/acceptance/accounts/set-password-test.js b/ui/core/tests/acceptance/accounts/set-password-test.js index d03dff3d1..442f468ee 100644 --- a/ui/core/tests/acceptance/accounts/set-password-test.js +++ b/ui/core/tests/acceptance/accounts/set-password-test.js @@ -61,9 +61,11 @@ module('Acceptance | accounts | set password', function (hooks) { test('can set a new password for account', async function (assert) { assert.expect(1); - this.server.post('/accounts/:id', (_, { requestBody }) => { + this.server.post('/accounts/:idMethod', (_, { params: { idMethod }, requestBody }) => { const attrs = JSON.parse(requestBody); assert.equal(attrs.password, 'update password', 'new password is set'); + const id = idMethod.split(':')[0]; + return { id }; }); await visit(urls.setPassword); await fillIn('[name="password"]', 'update password'); diff --git a/ui/core/tests/acceptance/roles/grants-test.js b/ui/core/tests/acceptance/roles/grants-test.js index e767928fb..f7391742b 100644 --- a/ui/core/tests/acceptance/roles/grants-test.js +++ b/ui/core/tests/acceptance/roles/grants-test.js @@ -58,9 +58,11 @@ module('Acceptance | roles | grants', function (hooks) { test('update a grant', async function(assert) { assert.expect(1); - this.server.post('/roles/:id', (_, { requestBody }) => { + this.server.post('/roles/:idMethod', (_, { params: { idMethod }, requestBody }) => { const attrs = JSON.parse(requestBody); assert.equal(attrs.grant_strings[0], 'id=123,action=delete', "A grant is updated"); + const id = idMethod.split(':')[0]; + return { id }; }); await visit(urls.grants); await fillIn(`${grantsForm} [name="grant"]`, 'id=123,action=delete'); @@ -90,7 +92,7 @@ module('Acceptance | roles | grants', function (hooks) { ); }); await visit(urls.grants); - assert.equal(findAll(`${grantsForm} [name="grant"]`).length, + assert.equal(findAll(`${grantsForm} [name="grant"]`).length, grantsCount); await fillIn(`${grantsForm} [name="grant"]`, 'id=123,action=delete'); await click('.rose-form-actions [type="submit"]:not(:disabled)'); @@ -99,9 +101,11 @@ module('Acceptance | roles | grants', function (hooks) { test('create a grant', async function(assert) { assert.expect(1); - this.server.post('/roles/:id', (_, { requestBody }) => { + this.server.post('/roles/:idMethod', (_, { params: { idMethod }, requestBody }) => { const attrs = JSON.parse(requestBody); assert.equal(attrs.grant_strings.length, grantsCount + 1, "A grant is created"); + const id = idMethod.split(':')[0]; + return { id }; }); await visit(urls.grants); await fillIn(`${newGrantForm} [name="grant"]`, 'id=123,action=delete'); @@ -133,7 +137,7 @@ module('Acceptance | roles | grants', function (hooks) { ); }); await visit(urls.grants); - assert.equal(findAll(`${grantsForm} [name="grant"]`).length, + assert.equal(findAll(`${grantsForm} [name="grant"]`).length, grantsCount); await fillIn(`${newGrantForm} [name="grant"]`, 'id=123,action=delete'); await click(`${newGrantForm} [type="submit"]:not(:disabled)`); @@ -146,7 +150,7 @@ module('Acceptance | roles | grants', function (hooks) { await visit(urls.grants); await click(`${grantsForm} button:not([type="submit"])`); await click('.rose-form-actions [type="submit"]:not(:disabled)'); - assert.equal(findAll(`${grantsForm} [name="grant"]`).length, + assert.equal(findAll(`${grantsForm} [name="grant"]`).length, grantsCount - 1); }); @@ -173,7 +177,7 @@ module('Acceptance | roles | grants', function (hooks) { ); }); await visit(urls.grants); - assert.equal(findAll(`${grantsForm} [name="grant"]`).length, + assert.equal(findAll(`${grantsForm} [name="grant"]`).length, grantsCount); await click(`${grantsForm} button:not([type="submit"])`); await click('.rose-form-actions [type="submit"]:not(:disabled)'); diff --git a/ui/core/tests/integration/components/bread-crumbs-test.js b/ui/core/tests/integration/components/bread-crumbs-test.js deleted file mode 100644 index 601741311..000000000 --- a/ui/core/tests/integration/components/bread-crumbs-test.js +++ /dev/null @@ -1,53 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find, findAll } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | bread-crumbs', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - this.set('breadCrumbs', [{ label: 'Level 1' }]); - - await render(hbs``); - // Default index route - assert.ok(find('.rose-nav-breadcrumbs a').href.match(/#$/)); - assert.equal(find('.rose-nav-breadcrumbs').textContent.trim(), 'Level 1'); - }); - - test('it renders with model', async function (assert) { - let store = this.owner.lookup('service:store'); - let scope = store.createRecord('scope'); - - this.set('breadCrumbs', [ - { - label: 'Level 1', - path: 'scopes.scope', - model: scope, - }, - ]); - - await render(hbs``); - assert.equal(find('.rose-nav-breadcrumbs').textContent.trim(), 'Level 1'); - }); - - test('it renders multiple breadCrumbs', async function (assert) { - this.set('breadCrumbs', [ - { - label: 'Level 1', - }, - { - label: 'Level 2', - }, - { - label: 'Level 3', - }, - ]); - - await render(hbs``); - assert.equal(findAll('a').length, 3); - assert.equal(findAll('a')[0].textContent.trim(), 'Level 1'); - assert.equal(findAll('a')[1].textContent.trim(), 'Level 2'); - assert.equal(findAll('a')[2].textContent.trim(), 'Level 3'); - }); -});