refactor: 💡 Updated Manage Dropdown in auth-methods accounts (#2432)

* refactor: 💡 Updated Manage Dropdown in auth-methods accounts

Updated Manage Dropdown in auth-methods account form to HDS

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14599

* refactor: 💡 Changed asssert statement in delete-test.js

Changed statement to reflect proper syntax and testing capability

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-14599
This commit is contained in:
Wadi authored and GitHub committed 2024-08-12 13:52:56 -04:00
1 parent 392792eb92
commit 69da1fa04c
2 files changed
+17 -17

No files matched your search

@@ -4,17 +4,12 @@
}}
{{#if (can 'delete account' @model)}}
<Rose::Dropdown
@text={{t 'actions.manage'}}
@dropdownRight={{true}}
as |dropdown|
>
<dropdown.button
@style='danger'
@disabled={{@model.canSave}}
<Hds::Dropdown data-test-manage-account-auth-methods as |dd|>
<dd.ToggleButton @text={{t 'actions.manage'}} @color='secondary' />
<dd.Interactive
@text={{t 'resources.account.actions.delete'}}
@color='critical'
{{on 'click' (fn @delete @model)}}
>
{{t 'resources.account.actions.delete'}}
</dropdown.button>
</Rose::Dropdown>
/>
</Hds::Dropdown>
{{/if}}
@@ -20,6 +20,11 @@ module('Acceptance | accounts | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const MANAGE_DROPDOWN_SELECTOR =
'[data-test-manage-account-auth-methods] div:first-child button';
const DELETE_ACTION_SELECTOR =
'[data-test-manage-account-auth-methods] ul li button';
const instances = {
scopes: {
global: null,
@@ -67,7 +72,8 @@ module('Acceptance | accounts | delete', function (hooks) {
test('can delete an account', async function (assert) {
const accountsCount = this.server.db.accounts.length;
await visit(urls.account);
await click('.rose-layout-page-actions .rose-dropdown-button-danger');
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
assert.strictEqual(this.server.db.accounts.length, accountsCount - 1);
});
@@ -75,9 +81,7 @@ module('Acceptance | accounts | delete', function (hooks) {
instances.account.authorized_actions =
instances.account.authorized_actions.filter((item) => item !== 'delete');
await visit(urls.account);
assert.notOk(
find('.rose-layout-page-actions .rose-dropdown-button-danger'),
);
assert.dom(MANAGE_DROPDOWN_SELECTOR).doesNotExist();
});
test('errors are displayed when delete on account fails', async function (assert) {
@@ -93,7 +97,8 @@ module('Acceptance | accounts | delete', function (hooks) {
);
});
await visit(urls.account);
await click('.rose-layout-page-actions .rose-dropdown-button-danger');
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await a11yAudit();
assert.strictEqual(
find('.rose-notification-body').textContent.trim(),