diff --git a/ui/admin/app/components/host-catalogs/host-catalog/actions/index.hbs b/ui/admin/app/components/host-catalogs/host-catalog/actions/index.hbs index 4eb6c91a0..ee745943f 100644 --- a/ui/admin/app/components/host-catalogs/host-catalog/actions/index.hbs +++ b/ui/admin/app/components/host-catalogs/host-catalog/actions/index.hbs @@ -3,35 +3,28 @@ SPDX-License-Identifier: BUSL-1.1 }} - + + {{#if (can 'create model' @model collection='hosts')}} - - {{t 'resources.host.actions.create'}} - + @text={{t 'resources.host.actions.create'}} + /> {{/if}} {{#if (can 'create model' @model collection='host-sets')}} - - {{t 'resources.host-set.actions.create'}} - + @text={{t 'resources.host-set.actions.create'}} + /> {{/if}} {{#if (can 'delete model' @model)}} - - + - {{t 'resources.host-catalog.actions.delete'}} - + /> {{/if}} - \ No newline at end of file + \ No newline at end of file diff --git a/ui/admin/tests/acceptance/host-catalogs/delete-test.js b/ui/admin/tests/acceptance/host-catalogs/delete-test.js index f766422b1..83c5776e7 100644 --- a/ui/admin/tests/acceptance/host-catalogs/delete-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/delete-test.js @@ -22,6 +22,10 @@ module('Acceptance | host-catalogs | delete', function (hooks) { setupIndexedDb(hooks); let getHostCatalogCount; + const MANAGE_DROPDOWN_SELECTOR = + '[data-test-manage-host-catalogs-dropdown] div:first-child button'; + const DELETE_ACTION_SELECTOR = + '[data-test-manage-host-catalogs-dropdown] ul li button'; const instances = { scopes: { @@ -70,7 +74,8 @@ module('Acceptance | host-catalogs | delete', function (hooks) { await visit(urls.hostCatalogs); await click(`[href="${urls.hostCatalog}"]`); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + await click(MANAGE_DROPDOWN_SELECTOR); + await click(DELETE_ACTION_SELECTOR); assert.strictEqual(getHostCatalogCount(), hostCatalogCount - 1); }); @@ -83,10 +88,9 @@ module('Acceptance | host-catalogs | delete', function (hooks) { ); await click(`[href="${urls.hostCatalog}"]`); + await click(MANAGE_DROPDOWN_SELECTOR); - assert - .dom('.rose-layout-page-actions .rose-dropdown-button-danger') - .doesNotExist(); + assert.dom(DELETE_ACTION_SELECTOR).doesNotExist(); }); test('can accept delete host catalog via dialog', async function (assert) { @@ -96,7 +100,8 @@ module('Acceptance | host-catalogs | delete', function (hooks) { await visit(urls.hostCatalogs); await click(`[href="${urls.hostCatalog}"]`); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + await click(MANAGE_DROPDOWN_SELECTOR); + await click(DELETE_ACTION_SELECTOR); await click('.rose-dialog .rose-button-primary'); assert.dom('.rose-notification-body').hasText('Deleted successfully.'); @@ -111,7 +116,8 @@ module('Acceptance | host-catalogs | delete', function (hooks) { await visit(urls.hostCatalogs); await click(`[href="${urls.hostCatalog}"]`); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + await click(MANAGE_DROPDOWN_SELECTOR); + await click(DELETE_ACTION_SELECTOR); await click('.rose-dialog .rose-button-secondary'); assert.strictEqual(getHostCatalogCount(), hostCatalogCount); @@ -133,7 +139,8 @@ module('Acceptance | host-catalogs | delete', function (hooks) { }); await click(`[href="${urls.hostCatalog}"]`); - await click('.rose-layout-page-actions .rose-dropdown-button-danger'); + await click(MANAGE_DROPDOWN_SELECTOR); + await click(DELETE_ACTION_SELECTOR); assert.dom('.rose-notification-body').hasText('Oops.'); }); diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js index 6b98ab0cd..76471da4d 100644 --- a/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/list-test.js @@ -18,6 +18,9 @@ module('Acceptance | host-catalogs | host sets | list', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + const MANAGE_DROPDOWN_SELECTOR = + '[data-test-manage-host-catalogs-dropdown] div:first-child button'; + const instances = { scopes: { global: null, @@ -94,7 +97,9 @@ module('Acceptance | host-catalogs | host sets | list', function (hooks) { 'create', ]; await visit(urls.hostCatalog); + assert.ok(find(`[href="${urls.hostSets}"]`)); - assert.ok(find(`.rose-layout-page-actions [href="${urls.newHostSet}"]`)); + + assert.dom(MANAGE_DROPDOWN_SELECTOR).exists(); }); }); diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js index 535d0fd87..fe208472a 100644 --- a/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/hosts/create-test.js @@ -20,6 +20,8 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) { setupMirage(hooks); let getHostCount; + const MANAGE_DROPDOWN_SELECTOR = + '[data-test-manage-host-catalogs-dropdown] div:first-child button'; const instances = { scopes: { @@ -101,7 +103,7 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) { 'create', ), ); - assert.ok(find(`[href="${urls.newHost}"]`)); + assert.dom(MANAGE_DROPDOWN_SELECTOR).exists(); }); test('Users cannot navigate to new host route without proper authorization', async function (assert) { diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js index abfc88e2a..1b3e64bb7 100644 --- a/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/hosts/list-test.js @@ -4,7 +4,7 @@ */ import { module, test } from 'qunit'; -import { visit, find } from '@ember/test-helpers'; +import { visit, find, click } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import { @@ -18,6 +18,11 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + const MANAGE_DROPDOWN_SELECTOR = + '[data-test-manage-host-catalogs-dropdown] div:first-child button'; + const NEW_HOST_SELECTOR = + '[data-test-manage-host-catalogs-dropdown] div ul li a'; + const instances = { scopes: { global: null, @@ -76,6 +81,7 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) { 'list', ), ); + assert.dom(MANAGE_DROPDOWN_SELECTOR); assert.ok(find(`[href="${urls.hosts}"]`)); }); @@ -94,6 +100,7 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) { instances.hostCatalog.authorized_collection_actions.hosts = ['create']; await visit(urls.hostCatalog); assert.ok(find(`[href="${urls.hosts}"]`)); - assert.ok(find(`.rose-layout-page-actions [href="${urls.newHost}"]`)); + await click(MANAGE_DROPDOWN_SELECTOR); + assert.dom(NEW_HOST_SELECTOR).hasAttribute('href', urls.newHost); }); });