diff --git a/ui/core/app/components/form/role/index.hbs b/ui/core/app/components/form/role/index.hbs index ed1330e4c..0e024b1fb 100644 --- a/ui/core/app/components/form/role/index.hbs +++ b/ui/core/app/components/form/role/index.hbs @@ -14,7 +14,6 @@ @label={{t "form.name.label"}} @helperText={{t "form.name.help"}} @error={{@model.errors.name}} - @helperText={{t "form.name.help"}} readonly={{false}} as |field|> {{#if @model.errors.name}} @@ -33,7 +32,6 @@ @label={{t "form.description.label"}} @helperText={{t "form.description.help"}} @error={{@model.errors.description}} - @helperText={{t "form.description.help"}} disabled={{@model.isSaving}} readonly={{false}} as |field|> diff --git a/ui/core/app/components/form/target/index.hbs b/ui/core/app/components/form/target/index.hbs index cb03dac6a..d54eff947 100644 --- a/ui/core/app/components/form/target/index.hbs +++ b/ui/core/app/components/form/target/index.hbs @@ -20,7 +20,6 @@ @label={{t "form.name.label"}} @helperText={{t "form.name.help"}} @error={{@model.errors.name}} - @helperText={{t "form.name.help"}} as |field|> {{#if @model.errors.name}} @@ -38,7 +37,6 @@ @label={{t "form.description.label"}} @helperText={{t "form.description.help"}} @error={{@model.errors.description}} - @helperText={{t "form.description.help"}} as |field|> {{#if @model.errors.description}} diff --git a/ui/core/tests/acceptance/accounts-test.js b/ui/core/tests/acceptance/accounts-test.js index fce8e5cb1..4f966114d 100644 --- a/ui/core/tests/acceptance/accounts-test.js +++ b/ui/core/tests/acceptance/accounts-test.js @@ -80,6 +80,7 @@ module('Acceptance | accounts', function (hooks) { assert.expect(1); await visit(urls.account); await fillIn('[name="name"]', 'update name'); + await click('form [type="button"]'); await click('form [type="submit"]:not(:disabled)'); assert.equal(this.server.db.accounts[0].name, 'update name'); }); @@ -87,6 +88,7 @@ module('Acceptance | accounts', function (hooks) { test('can update an account and cancel changes', async function (assert) { assert.expect(1); await visit(urls.account) + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'update name'); await click('form button:not([type="submit"])'); assert.notEqual(this.server.db.accounts[0].name, 'update name'); @@ -174,6 +176,7 @@ module('Acceptance | accounts', function (hooks) { }); await visit(urls.account); await fillIn('[name="name"]', 'save account'); + await click('form [type="button"]'); await click('form [type="submit"]'); await a11yAudit(); assert.ok( @@ -228,6 +231,7 @@ module('Acceptance | accounts', function (hooks) { ); }); await visit(urls.account); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'existing account'); await click('form [type="submit"]'); await a11yAudit(); diff --git a/ui/core/tests/acceptance/auth-methods-test.js b/ui/core/tests/acceptance/auth-methods-test.js index fa46de1ed..e1507f32e 100644 --- a/ui/core/tests/acceptance/auth-methods-test.js +++ b/ui/core/tests/acceptance/auth-methods-test.js @@ -66,6 +66,7 @@ module('Acceptance | auth methods', function (hooks) { test('can update an auth method and save changes', async function (assert) { assert.expect(1); await visit(urls.authMethod); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'update name'); await click('form [type="submit"]:not(:disabled)'); assert.equal(this.server.db.authMethods[0].name, 'update name'); @@ -74,6 +75,7 @@ module('Acceptance | auth methods', function (hooks) { test('can update an auth method and cancel changes', async function (assert) { assert.expect(1); await visit(urls.authMethod) + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'update name'); await click('form button:not([type="submit"])'); assert.notEqual(this.server.db.authMethods[0].name, 'update name'); @@ -160,6 +162,7 @@ module('Acceptance | auth methods', function (hooks) { }); await visit(urls.authMethod); await fillIn('[name="name"]', 'save auth method'); + await click('form [type="button"]'); await click('form [type="submit"]'); await a11yAudit(); assert.ok( @@ -192,7 +195,7 @@ module('Acceptance | auth methods', function (hooks) { ); }); - test('saving a new auth method with invalid fields displays error messages', async function (assert) { + test('saving an existing auth method with invalid fields displays error messages', async function (assert) { assert.expect(2); this.server.patch('/auth-methods/:id', () => { return new Response( @@ -214,6 +217,7 @@ module('Acceptance | auth methods', function (hooks) { ); }); await visit(urls.authMethod); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'existing auth method'); await click('form [type="submit"]'); await a11yAudit(); @@ -251,6 +255,7 @@ module('Acceptance | auth methods', function (hooks) { ); }); await visit(urls.authMethod); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'existing auth method'); await click('form [type="submit"]'); await a11yAudit(); diff --git a/ui/core/tests/acceptance/groups-test.js b/ui/core/tests/acceptance/groups-test.js index c3d2e5add..1dfb81a7c 100644 --- a/ui/core/tests/acceptance/groups-test.js +++ b/ui/core/tests/acceptance/groups-test.js @@ -116,6 +116,7 @@ module('Acceptance | groups', function (hooks) { test('can save changes to an existing group', async function (assert) { assert.expect(2); await visit(urls.group); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="submit"]'); assert.equal(currentURL(), urls.group); @@ -125,6 +126,7 @@ module('Acceptance | groups', function (hooks) { test('can cancel changes to an existing group', async function (assert) { assert.expect(1); await visit(urls.group); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated admin group'); await click('.rose-form-actions [type="button"]'); assert.notEqual(find('[name="name"]').value, 'Updated admin group'); @@ -160,6 +162,7 @@ module('Acceptance | groups', function (hooks) { ); }); await visit(urls.group); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -174,29 +177,6 @@ module('Acceptance | groups', function (hooks) { ); }); - test('errors are displayed when save project fails', async function (assert) { - assert.expect(1); - this.server.patch('/groups/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.group); - await fillIn('[name="name"]', 'Role name'); - await click('[type="submit"]'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); - }); - test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); this.server.del('/groups/:id', () => { diff --git a/ui/core/tests/acceptance/host-catalogs-test.js b/ui/core/tests/acceptance/host-catalogs-test.js index a9438517e..bcb07a0a3 100644 --- a/ui/core/tests/acceptance/host-catalogs-test.js +++ b/ui/core/tests/acceptance/host-catalogs-test.js @@ -84,6 +84,7 @@ module('Acceptance | host catalogs', function (hooks) { test('can update host catalog and save changes', async function (assert) { assert.expect(1); await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Test Name'); await click('form [type="submit"]:not(:disabled)'); assert.equal(this.server.db.hostCatalogs[0].name, 'Test Name'); @@ -92,6 +93,7 @@ module('Acceptance | host catalogs', function (hooks) { test('can update host catalog and cancel changes', async function (assert) { assert.expect(1); await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Test Name'); await click('form button:not([type="submit"])'); assert.notEqual(this.server.db.hostCatalogs[0].name, 'Test Name'); @@ -115,30 +117,6 @@ module('Acceptance | host catalogs', function (hooks) { assert.equal(this.server.db.hostCatalogs.length, hostCatalogsCount); }); - test('errors are displayed when save host catalog fails', async function (assert) { - assert.expect(1); - this.server.patch('/host-catalogs/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.hostCatalog); - await fillIn('[name="name"]', 'random string'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); - }); - test('errors are displayed when delete host catalog fails', async function (assert) { assert.expect(1); this.server.del('/host-catalogs/:id', () => { @@ -221,6 +199,7 @@ module('Acceptance | host catalogs', function (hooks) { ); }); await visit(urls.hostCatalog); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); await click('form [type="submit"]'); await a11yAudit(); diff --git a/ui/core/tests/acceptance/host-sets-test.js b/ui/core/tests/acceptance/host-sets-test.js index 3c69e1b0e..1fdfc0f91 100644 --- a/ui/core/tests/acceptance/host-sets-test.js +++ b/ui/core/tests/acceptance/host-sets-test.js @@ -73,6 +73,7 @@ module('Acceptance | host sets', function (hooks) { test('can update a host set and save changes', async function (assert) { assert.expect(3); await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated name'); await fillIn('[name="description"]', 'Updated description'); await click('.rose-form-actions [type="submit"]'); @@ -84,6 +85,7 @@ module('Acceptance | host sets', function (hooks) { test('can update a host set and cancel changes', async function (assert) { assert.expect(1); await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated name'); await click('.rose-form-actions [type="button"]'); assert.notEqual(find('[name="name"]').value, 'Updated name'); @@ -120,6 +122,7 @@ module('Acceptance | host sets', function (hooks) { ); }); await visit(urls.hostSet); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'existing host'); await click('[type="submit"]'); await a11yAudit(); @@ -127,26 +130,6 @@ module('Acceptance | host sets', function (hooks) { assert.ok(find('.rose-form-error-message')); }); - test('errors are displayed when save on host set fails', async function (assert) { - assert.expect(1); - this.server.patch('/host-sets/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.hostSet); - await fillIn('[name="name"]', 'save host'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - }); - test('errors are displayed when delete on a host set fails', async function (assert) { assert.expect(1); this.server.del('/host-sets/:id', () => { diff --git a/ui/core/tests/acceptance/hosts-test.js b/ui/core/tests/acceptance/hosts-test.js index 27881f02b..2514210fb 100644 --- a/ui/core/tests/acceptance/hosts-test.js +++ b/ui/core/tests/acceptance/hosts-test.js @@ -73,6 +73,7 @@ module('Acceptance | hosts', function (hooks) { test('can update a host and save changes', async function (assert) { assert.expect(4); await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated name'); await fillIn('[name="description"]', 'Updated description'); await fillIn('[name="address"]', '::1'); @@ -86,6 +87,7 @@ module('Acceptance | hosts', function (hooks) { test('can update a host and cancel changes', async function (assert) { assert.expect(1); await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated name'); await click('.rose-form-actions [type="button"]'); assert.notEqual(find('[name="name"]').value, 'Updated name'); @@ -122,6 +124,7 @@ module('Acceptance | hosts', function (hooks) { ); }); await visit(urls.host); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'existing host'); await click('[type="submit"]'); await a11yAudit(); @@ -129,26 +132,6 @@ module('Acceptance | hosts', function (hooks) { assert.ok(find('.rose-form-error-message')); }); - test('errors are displayed when save on host fails', async function (assert) { - assert.expect(1); - this.server.patch('/hosts/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.host); - await fillIn('[name="name"]', 'save host'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - }); - test('errors are displayed when delete on a host fails', async function (assert) { assert.expect(1); this.server.del('/hosts/:id', () => { diff --git a/ui/core/tests/acceptance/projects-test.js b/ui/core/tests/acceptance/projects-test.js index f29002157..0483a56c8 100644 --- a/ui/core/tests/acceptance/projects-test.js +++ b/ui/core/tests/acceptance/projects-test.js @@ -117,6 +117,7 @@ module('Acceptance | projects', function (hooks) { assert.expect(3); assert.notEqual(existingProject.name, 'random string'); await visit(existingProjectURL); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); await click('.rose-form-actions [type="submit"]'); assert.equal(currentURL(), existingProjectURL); @@ -126,6 +127,7 @@ module('Acceptance | projects', function (hooks) { test('can cancel changes to existing project', async function (assert) { assert.expect(2); await visit(existingProjectURL); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); await click('.rose-form-actions [type="button"]'); assert.notEqual(existingProject.name, 'random string'); @@ -161,6 +163,7 @@ module('Acceptance | projects', function (hooks) { ); }); await visit(existingProjectURL); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -175,29 +178,6 @@ module('Acceptance | projects', function (hooks) { ); }); - test('errors are displayed when save project fails', async function (assert) { - assert.expect(1); - this.server.patch('/scopes/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(existingProjectURL); - await fillIn('[name="name"]', 'random string'); - await click('[type="submit"]'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); - }); - test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); this.server.del('/scopes/:id', () => { diff --git a/ui/core/tests/acceptance/roles-test.js b/ui/core/tests/acceptance/roles-test.js index eee3ffa50..4060a9cd1 100644 --- a/ui/core/tests/acceptance/roles-test.js +++ b/ui/core/tests/acceptance/roles-test.js @@ -62,6 +62,7 @@ module('Acceptance | roles', function (hooks) { test('can save changes to an existing role', async function (assert) { assert.expect(2); await visit(urls.role); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="submit"]'); assert.equal(currentURL(), urls.role); @@ -71,6 +72,7 @@ module('Acceptance | roles', function (hooks) { test('can cancel changes to an existing role', async function (assert) { assert.expect(1); await visit(urls.role); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated admin role'); await click('.rose-form-actions [type="button"]'); assert.notEqual(find('[name="name"]').value, 'Updated admin role'); @@ -154,6 +156,7 @@ module('Acceptance | roles', function (hooks) { ); }); await visit(urls.role); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.ok( @@ -168,29 +171,6 @@ module('Acceptance | roles', function (hooks) { ); }); - test('errors are displayed when save project fails', async function (assert) { - assert.expect(1); - this.server.patch('/roles/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.role); - await fillIn('[name="name"]', 'Role name'); - await click('[type="submit"]'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); - }); - test('errors are displayed when delete project fails', async function (assert) { assert.expect(1); this.server.del('/roles/:id', () => { diff --git a/ui/core/tests/acceptance/targets-test.js b/ui/core/tests/acceptance/targets-test.js index 7cf31d8c5..a269173b0 100644 --- a/ui/core/tests/acceptance/targets-test.js +++ b/ui/core/tests/acceptance/targets-test.js @@ -92,6 +92,7 @@ module('Acceptance | targets', function (hooks) { test('can update a target and save changes', async function (assert) { assert.expect(2); await visit(urls.target); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'update name'); await fillIn('[name="default_port"]', '1234'); await click('form [type="submit"]:not(:disabled)'); @@ -102,6 +103,7 @@ module('Acceptance | targets', function (hooks) { test('can update a target and cancel changes', async function (assert) { assert.expect(2); await visit(urls.target); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'update name'); await fillIn('[name="default_port"]', '1234'); await click('form button:not([type="submit"])'); @@ -167,26 +169,6 @@ module('Acceptance | targets', function (hooks) { assert.ok(find('.rose-form-error-message')); }); - test('errors are displayed when save on target fails', async function (assert) { - assert.expect(1); - this.server.patch('/targets/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(urls.target); - await fillIn('[name="name"]', 'save target'); - await click('form [type="submit"]'); - await a11yAudit(); - assert.ok(find('[role="alert"]')); - }); - test('errors are displayed when delete on a target fails', async function (assert) { assert.expect(1); this.server.del('/targets/:id', () => { @@ -228,6 +210,7 @@ module('Acceptance | targets', function (hooks) { ); }); await visit(urls.target); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'existing target'); await click('form [type="submit"]'); await a11yAudit(); @@ -245,7 +228,7 @@ module('Acceptance | targets', function (hooks) { assert.equal(findAll('tbody tr').length, targetHostSetCount); }); - test('can delete a host sets', async function (assert) { + test('can remove a host sets', async function (assert) { assert.expect(2); const targetHostSetCount = instances.target.hostSets.length; await visit(urls.targetHostSets); diff --git a/ui/core/tests/acceptance/users-test.js b/ui/core/tests/acceptance/users-test.js index 36e57926a..065f8974b 100644 --- a/ui/core/tests/acceptance/users-test.js +++ b/ui/core/tests/acceptance/users-test.js @@ -112,6 +112,7 @@ module('Acceptance | users', function (hooks) { test('can save changes to an existing user', async function (assert) { assert.expect(2); await visit(userURL); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Updated user name'); await click('.rose-form-actions [type="submit"]'); assert.equal(currentURL(), userURL); @@ -121,6 +122,7 @@ module('Acceptance | users', function (hooks) { test('can cancel changes to an existing user', async function (assert) { assert.expect(1); await visit(userURL); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'Unsaved user name'); await click('.rose-form-actions [type="button"]'); assert.notEqual(find('[name="name"]').value, 'Unsaved user name'); @@ -156,6 +158,7 @@ module('Acceptance | users', function (hooks) { ); }); await visit(userURL); + await click('form [type="button"]', 'Activate edit mode'); await fillIn('[name="name"]', 'User name'); await click('[type="submit"]'); assert.ok( @@ -170,29 +173,6 @@ module('Acceptance | users', function (hooks) { ); }); - test('errors are displayed when saving user fails', async function (assert) { - assert.expect(1); - this.server.patch('/users/:id', () => { - return new Response( - 490, - {}, - { - status: 490, - code: 'error', - message: 'Oops.', - } - ); - }); - await visit(userURL); - await fillIn('[name="name"]', 'User name'); - await click('[type="submit"]'); - assert.ok( - find('[role="alert"]').textContent.trim(), - 'Oops.', - 'Displays primary error message.' - ); - }); - test('errors are displayed when user deletion fails', async function (assert) { assert.expect(1); this.server.del('/users/:id', () => {