diff --git a/web/app/components/document/sidebar.hbs b/web/app/components/document/sidebar.hbs index 040eb6eda..9b3144269 100644 --- a/web/app/components/document/sidebar.hbs +++ b/web/app/components/document/sidebar.hbs @@ -56,21 +56,14 @@ - <:item as |dd|> diff --git a/web/app/components/project/index.hbs b/web/app/components/project/index.hbs index 7da9436ee..3b3f0b78b 100644 --- a/web/app/components/project/index.hbs +++ b/web/app/components/project/index.hbs @@ -23,12 +23,12 @@ {{this.statusLabel}} - <:item as |dd|> diff --git a/web/app/components/x/dropdown-list/items.ts b/web/app/components/x/dropdown-list/items.ts index f1a254deb..37ef99198 100644 --- a/web/app/components/x/dropdown-list/items.ts +++ b/web/app/components/x/dropdown-list/items.ts @@ -54,6 +54,10 @@ export default class XDropdownListItemsComponent extends Component {{yield}} + {{#if @hasChevron}} + + {{/if}} diff --git a/web/app/components/x/dropdown-list/toggle-action.ts b/web/app/components/x/dropdown-list/toggle-action.ts index 3e3baed31..8b58be274 100644 --- a/web/app/components/x/dropdown-list/toggle-action.ts +++ b/web/app/components/x/dropdown-list/toggle-action.ts @@ -3,7 +3,9 @@ import { XDropdownListToggleComponentArgs } from "./_shared"; interface XDropdownListToggleActionComponentSignature { Element: HTMLButtonElement; - Args: XDropdownListToggleComponentArgs; + Args: XDropdownListToggleComponentArgs & { + hasChevron?: boolean; + }; Blocks: { default: []; }; diff --git a/web/app/styles/components/sidebar.scss b/web/app/styles/components/sidebar.scss index 635feecdd..4ff9a6d2a 100644 --- a/web/app/styles/components/sidebar.scss +++ b/web/app/styles/components/sidebar.scss @@ -50,15 +50,10 @@ } .draft-visibility-button { - @apply px-2.5; // match the height of the header buttons @apply h-[38px]; // offset the extra height relative to the badge @apply my-[-7px]; - - [class*=" flight-icon-chevron"] { - @apply ml-px -mr-px; - } } .sidebar-header-icon-controls { diff --git a/web/tests/acceptance/authenticated/document-test.ts b/web/tests/acceptance/authenticated/document-test.ts index 8e594a7c8..b7579b649 100644 --- a/web/tests/acceptance/authenticated/document-test.ts +++ b/web/tests/acceptance/authenticated/document-test.ts @@ -237,9 +237,6 @@ module("Acceptance | authenticated/document", function (hooks) { assert .dom(DRAFT_VISIBILITY_TOGGLE_SELECTOR) .hasAttribute("data-test-icon", DraftVisibilityIcon.Restricted); - assert - .dom(DRAFT_VISIBILITY_TOGGLE_SELECTOR) - .hasAttribute("data-test-chevron-direction", "down"); assert.dom(TOOLTIP_SELECTOR).doesNotExist(); @@ -251,9 +248,6 @@ module("Acceptance | authenticated/document", function (hooks) { await click(DRAFT_VISIBILITY_TOGGLE_SELECTOR); - assert - .dom(DRAFT_VISIBILITY_TOGGLE_SELECTOR) - .hasAttribute("data-test-chevron-direction", "up"); assert.dom(DRAFT_VISIBILITY_DROPDOWN_SELECTOR).exists("dropdown is open"); assert.dom(DRAFT_VISIBILITY_OPTION_SELECTOR).exists({ count: 2 }); diff --git a/web/tests/integration/components/x/dropdown-list/index-test.ts b/web/tests/integration/components/x/dropdown-list/index-test.ts index b083faac9..846a8a2d6 100644 --- a/web/tests/integration/components/x/dropdown-list/index-test.ts +++ b/web/tests/integration/components/x/dropdown-list/index-test.ts @@ -44,6 +44,7 @@ const DEFAULT_NO_MATCHES_SELECTOR = ".x-dropdown-list-default-empty-state"; const LOADED_CONTENT_SELECTOR = "[data-test-x-dropdown-list-loaded-content]"; const LOADING_BLOCK_SELECTOR = "[data-test-x-dropdown-list-loading-block]"; const DEFAULT_LOADER_SELECTOR = ".x-dropdown-list-default-loading-container"; +const TOGGLE_ACTION_CHEVRON = "[data-test-toggle-action-chevron]"; interface XDropdownListComponentTestContext extends TestContext { items: Record; @@ -52,6 +53,7 @@ interface XDropdownListComponentTestContext extends TestContext { isLoading?: boolean; placement?: Placement | null; selected?: string; + hasChevron?: boolean; } module("Integration | Component | x/dropdown-list", function (hooks) { @@ -629,6 +631,33 @@ module("Integration | Component | x/dropdown-list", function (hooks) { ); }); + test("the toggle action can render with a chevron", async function (assert) { + this.set("hasChevron", false); + + await render(hbs` + + <:anchor as |dd|> + + --- + + + + `); + + assert.dom(TOGGLE_ACTION_CHEVRON).doesNotExist(); + + this.set("hasChevron", true); + + assert.dom(TOGGLE_ACTION_CHEVRON).exists(); + assert.dom(TOGGLE_ACTION_CHEVRON).hasClass("flight-icon-chevron-down"); + + await click(TOGGLE_ACTION_SELECTOR); + + assert.dom(TOGGLE_ACTION_SELECTOR).hasClass("open"); + + assert.dom(TOGGLE_ACTION_CHEVRON).hasClass("flight-icon-chevron-up"); + }); + test("the list can be rendered with a toggle button", async function (assert) { this.set("items", SHORT_ITEM_LIST);