diff --git a/ui/core/app/components/form/target/add-host-sets/index.hbs b/ui/core/app/components/form/target/add-host-sets/index.hbs
index fa02412bb..545f45f91 100644
--- a/ui/core/app/components/form/target/add-host-sets/index.hbs
+++ b/ui/core/app/components/form/target/add-host-sets/index.hbs
@@ -18,7 +18,7 @@
{{account.auth_method_id}}
+ {{t "resources.user.messages.add-accounts.description"}}
diff --git a/ui/core/tests/acceptance/users/accounts-test.js b/ui/core/tests/acceptance/users/accounts-test.js index 0dead76e1..8bcaa951a 100644 --- a/ui/core/tests/acceptance/users/accounts-test.js +++ b/ui/core/tests/acceptance/users/accounts-test.js @@ -41,7 +41,7 @@ module('Acceptance | users | accounts', function (hooks) { this.server.create('auth-method', { scope: instances.scopes.org }, 'withAccountsAndUsers'); - instances.user = this.server.db.users[0]; + instances.user = this.server.schema.users.all().models[0]; accountsCount = instances.user.accountIds.length; urls.users = `/scopes/${instances.scopes.org.id}/users`; urls.user = `${urls.users}/${instances.user.id}`; @@ -85,58 +85,58 @@ module('Acceptance | users | accounts', function (hooks) { assert.ok(find('[role="alert"]')); }); - // test('visiting account add accounts', async function(assert) { - // assert.expect(1); - // await visit(urls.addAccounts); - // await a11yAudit(); - // assert.equal(currentURL(), urls.addAccounts); - // }); - // - // test('select and save accounts to add', async function (assert) { - // assert.expect(3); - // instances.user.update({ accountIds: [] }); - // await visit(urls.accounts); - // assert.equal(findAll('tbody tr').length, 0); - // await click('.rose-layout-page-actions a') - // assert.equal(currentURL(), urls.addAccounts); - // await click('tbody label'); - // await click('form [type="submit"]'); - // await visit(urls.accounts); - // assert.equal(findAll('tbody tr').length, 1); - // }); - // - // test('select and cancel accounts to add', async function (assert) { - // assert.expect(4); - // await visit(urls.accounts); - // assert.equal(findAll('tbody tr').length, accountsCount); - // await click('tbody tr .rose-dropdown-button-danger'); - // assert.equal(findAll('tbody tr').length, accountsCount - 1); - // await click('.rose-layout-page-actions a') - // assert.equal(currentURL(), urls.addAccounts); - // await click('tbody label'); - // await click('form [type="button"]'); - // await visit(urls.accounts); - // assert.equal(findAll('tbody tr').length, accountsCount - 1); - // }); - // - // test('shows error message on account add', async function (assert) { - // assert.expect(1); - // this.server.post('/users/:idMethod', () => { - // return new Response( - // 400, - // {}, - // { - // status: 400, - // code: 'invalid_argument', - // message: 'The request was invalid.', - // details: {}, - // } - // ); - // }); - // instances.user.update({ accountIds: [] }); - // await visit(urls.addAccounts); - // await click('tbody label'); - // await click('form [type="submit"]'); - // assert.ok(find('[role="alert"]')); - // }); + test('visiting account add accounts', async function(assert) { + assert.expect(1); + await visit(urls.addAccounts); + await a11yAudit(); + assert.equal(currentURL(), urls.addAccounts); + }); + + test('select and save accounts to add', async function (assert) { + assert.expect(3); + instances.user.update({ accountIds: [] }); + await visit(urls.accounts); + assert.equal(findAll('tbody tr').length, 0); + await click('.rose-layout-page-actions a') + assert.equal(currentURL(), urls.addAccounts); + await click('tbody label'); + await click('form [type="submit"]'); + await visit(urls.accounts); + assert.equal(findAll('tbody tr').length, 1); + }); + + test('select and cancel accounts to add', async function (assert) { + assert.expect(4); + await visit(urls.accounts); + assert.equal(findAll('tbody tr').length, accountsCount); + await click('tbody tr .rose-dropdown-button-danger'); + assert.equal(findAll('tbody tr').length, accountsCount - 1); + await click('.rose-layout-page-actions a') + assert.equal(currentURL(), urls.addAccounts); + await click('tbody label'); + await click('form [type="button"]'); + await visit(urls.accounts); + assert.equal(findAll('tbody tr').length, accountsCount - 1); + }); + + test('shows error message on account add', async function (assert) { + assert.expect(1); + this.server.post('/users/:idMethod', () => { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: {}, + } + ); + }); + instances.user.update({ accountIds: [] }); + await visit(urls.addAccounts); + await click('tbody label'); + await click('form [type="submit"]'); + assert.ok(find('[role="alert"]')); + }); }); diff --git a/ui/core/tests/integration/components/form/user/add-accounts-test.js b/ui/core/tests/integration/components/form/user/add-accounts-test.js new file mode 100644 index 000000000..ba96e4dba --- /dev/null +++ b/ui/core/tests/integration/components/form/user/add-accounts-test.js @@ -0,0 +1,12 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +// import { render } from '@ember/test-helpers'; +// import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | form/user/add-accounts', function(hooks) { + setupRenderingTest(hooks); + + test('it renders', async function(assert) { + assert.expect(0); + }); +}); diff --git a/ui/core/tests/unit/routes/scopes/scope/users/user/add-accounts-test.js b/ui/core/tests/unit/routes/scopes/scope/users/user/add-accounts-test.js new file mode 100644 index 000000000..2aac18540 --- /dev/null +++ b/ui/core/tests/unit/routes/scopes/scope/users/user/add-accounts-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Route | scopes/scope/users/user/add-accounts', function(hooks) { + setupTest(hooks); + + test('it exists', function(assert) { + let route = this.owner.lookup('route:scopes/scope/users/user/add-accounts'); + assert.ok(route); + }); +}); diff --git a/ui/core/translations/resources/en-us.yaml b/ui/core/translations/resources/en-us.yaml index dd1b7848d..81ade9e0f 100644 --- a/ui/core/translations/resources/en-us.yaml +++ b/ui/core/translations/resources/en-us.yaml @@ -128,6 +128,9 @@ user: add-accounts: title: Add Accounts description: Select accounts to associate with this user. + no-accounts: + title: No Accounts Available + description: There are no accounts available to add to this user. actions: add-accounts: Add Accounts role: