A platform for community discussion. Free, open, simple.
DEV: allow custom sidebar sections to use the "more" links menu (#42870)
Kris4e61b9466bb8
diff --git a/frontend/discourse/app/components/sidebar/api-section.gjs b/frontend/discourse/app/components/sidebar/api-section.gjsindex 32a64f5bb2b..4e0fc34b559 100644--- a/frontend/discourse/app/components/sidebar/api-section.gjs+++ b/frontend/discourse/app/components/sidebar/api-section.gjs@@ -1,76 +1,143 @@-import { hash } from "@ember/helper";+import Component from "@glimmer/component";+import { concat, hash } from "@ember/helper";import curryComponent from "ember-curry-component";import { and, eq, not } from "discourse/truth-helpers";+import MoreSectionLink from "./more-section-link";+import MoreSectionLinks from "./more-section-links";import Section from "./section";import SectionLink from "./section-link";-const SidebarApiSection = <template>- {{#if @section.filtered}}- <Section- @sectionName={{@section.name}}- @headerLinkText={{@section.text}}- @headerLinkTitle={{@section.title}}- @headerActionsIcon={{@section.actionsIcon}}- @headerActions={{@section.actions}}- @willDestroy={{@section.willDestroy}}- @collapsable={{@collapsable}}- @displaySection={{@section.displaySection}}- @hideSectionHeader={{@section.hideSectionHeader}}- @collapsedByDefault={{@section.collapsedByDefault}}- @activeLink={{@section.activeLink}}- @expandWhenActive={{@expandWhenActive}}- @scrollActiveLinkIntoView={{@scrollActiveLinkIntoView}}- >- {{#if- (and @section.emptyStateComponent (not @section.filteredLinks.length))- }}- <@section.emptyStateComponent />- {{/if}}+export default class SidebarApiSection extends Component {+ get moreLinks() {+ return this.args.section.filteredMoreLinks ?? [];+ }- {{#each @section.filteredLinks key="name" as |link|}}- <SectionLink- @linkName={{link.name}}- @linkClass={{link.classNames}}- @route={{link.route}}- @model={{link.model}}- @query={{link.query}}- @models={{link.models}}- @currentWhen={{link.currentWhen}}- @href={{link.href}}- @title={{link.title}}- @badgeText={{link.badgeText}}- @contentCSSClass={{link.contentCSSClass}}- @prefixColor={{link.prefixColor}}- @prefixBadge={{link.prefixBadge}}- @prefixType={{link.prefixType}}- @prefixValue={{link.prefixValue}}- @prefixCSSClass={{link.prefixCSSClass}}- @suffixType={{link.suffixType}}- @suffixValue={{link.suffixValue}}- @suffixCSSClass={{link.suffixCSSClass}}- @hoverType={{link.hoverType}}- @hoverValue={{link.hoverValue}}- @hoverAction={{link.hoverAction}}- @hoverTitle={{link.hoverTitle}}- @didInsert={{link.didInsert}}- @willDestroy={{link.willDestroy}}- @content={{link.text}}- @contentComponent={{if- link.contentComponent- (curryComponent- link.contentComponent (hash status=link.contentComponentArgs)- )- }}- @suffixComponent={{link.suffixComponent}}- @suffixArgs={{link.suffixArgs}}- @scrollIntoView={{and- @scrollActiveLinkIntoView- (eq link.name @section.activeLink.name)- }}- />- {{/each}}- </Section>- {{/if}}-</template>;+ get moreLinksAtStart() {+ return this.args.section.moreLinksPosition === "start";+ }-export default SidebarApiSection;+ <template>+ {{#if @section.filtered}}+ <Section+ @sectionName={{@section.name}}+ @headerLinkText={{@section.text}}+ @headerLinkTitle={{@section.title}}+ @headerActionsIcon={{@section.actionsIcon}}+ @headerActions={{@section.actions}}+ @willDestroy={{@section.willDestroy}}+ @collapsable={{@collapsable}}+ @displaySection={{@section.displaySection}}+ @hideSectionHeader={{@section.hideSectionHeader}}+ @collapsedByDefault={{@section.collapsedByDefault}}+ @activeLink={{@section.activeLink}}+ @expandWhenActive={{@expandWhenActive}}+ @scrollActiveLinkIntoView={{@scrollActiveLinkIntoView}}+ >+ {{#if+ (and @section.emptyStateComponent (not @section.filteredLinks.length))+ }}+ <@section.emptyStateComponent />+ {{/if}}++ {{#if this.moreLinksAtStart}}+ {{#if this.moreLinks}}+ {{#if @section.moreLinksInline}}+ {{#each this.moreLinks as |sectionLink|}}+ <MoreSectionLink+ @sectionLink={{sectionLink}}+ @scrollIntoView={{and+ @scrollActiveLinkIntoView+ (eq sectionLink.name @section.activeLink.name)+ }}+ />+ {{/each}}+ {{else}}+ <MoreSectionLinks+ @sectionLinks={{this.moreLinks}}+ @scrollActiveLinkIntoView={{@scrollActiveLinkIntoView}}+ @identifier={{concat "sidebar-more-" @section.name}}+ @triggerText={{@section.moreLinksTriggerText}}+ @triggerPrefixType={{@section.moreLinksTriggerPrefixType}}+ @triggerPrefixValue={{@section.moreLinksTriggerPrefixValue}}+ @triggerSuffixType={{@section.moreLinksTriggerSuffixType}}+ @triggerSuffixValue={{@section.moreLinksTriggerSuffixValue}}+ @hoistActiveLink={{@section.moreLinksHoistActiveLink}}+ />+ {{/if}}+ {{/if}}+ {{/if}}++ {{#each @section.filteredLinks key="name" as |link|}}+ <SectionLink+ @linkName={{link.name}}+ @linkClass={{link.classNames}}+ @route={{link.route}}+ @model={{link.model}}+ @query={{link.query}}+ @models={{link.models}}+ @currentWhen={{link.currentWhen}}+ @href={{link.href}}+ @title={{link.title}}+ @badgeText={{link.badgeText}}+ @contentCSSClass={{link.contentCSSClass}}+ @prefixColor={{link.prefixColor}}+ @prefixBadge={{link.prefixBadge}}+ @prefixType={{link.prefixType}}+ @prefixValue={{link.prefixValue}}+ @prefixCSSClass={{link.prefixCSSClass}}+ @suffixType={{link.suffixType}}+ @suffixValue={{link.suffixValue}}+ @suffixCSSClass={{link.suffixCSSClass}}+ @hoverType={{link.hoverType}}+ @hoverValue={{link.hoverValue}}+ @hoverAction={{link.hoverAction}}+ @hoverTitle={{link.hoverTitle}}+ @didInsert={{link.didInsert}}+ @willDestroy={{link.willDestroy}}+ @content={{link.text}}+ @contentComponent={{if+ link.contentComponent+ (curryComponent+ link.contentComponent (hash status=link.contentComponentArgs)+ )+ }}+ @suffixComponent={{link.suffixComponent}}+ @suffixArgs={{link.suffixArgs}}+ @scrollIntoView={{and+ @scrollActiveLinkIntoView+ (eq link.name @section.activeLink.name)+ }}+ />+ {{/each}}++ {{#unless this.moreLinksAtStart}}+ {{#if this.moreLinks}}+ {{#if @section.moreLinksInline}}+ {{#each this.moreLinks as |sectionLink|}}+ <MoreSectionLink+ @sectionLink={{sectionLink}}+ @scrollIntoView={{and+ @scrollActiveLinkIntoView+ (eq sectionLink.name @section.activeLink.name)+ }}+ />+ {{/each}}+ {{else}}+ <MoreSectionLinks+ @sectionLinks={{this.moreLinks}}+ @scrollActiveLinkIntoView={{@scrollActiveLinkIntoView}}+ @identifier={{concat "sidebar-more-" @section.name}}+ @triggerText={{@section.moreLinksTriggerText}}+ @triggerPrefixType={{@section.moreLinksTriggerPrefixType}}+ @triggerPrefixValue={{@section.moreLinksTriggerPrefixValue}}+ @triggerSuffixType={{@section.moreLinksTriggerSuffixType}}+ @triggerSuffixValue={{@section.moreLinksTriggerSuffixValue}}+ @hoistActiveLink={{@section.moreLinksHoistActiveLink}}+ />+ {{/if}}+ {{/if}}+ {{/unless}}+ </Section>+ {{/if}}+ </template>+}diff --git a/frontend/discourse/app/components/sidebar/api-sections.gjs b/frontend/discourse/app/components/sidebar/api-sections.gjsindex f8f8f5a49de..121d0804878 100644--- a/frontend/discourse/app/components/sidebar/api-sections.gjs+++ b/frontend/discourse/app/components/sidebar/api-sections.gjs@@ -68,15 +68,28 @@ function prepareSidebarSectionClass(Section, routerService) {@cachedget filteredLinks() {+ return this.#applyFilter(this.links);+ }++ @cached+ get filteredMoreLinks() {+ return this.#applyFilter(this.moreLinks);+ }++ #applyFilter(links) {+ if (!links?.length) {+ return links;+ }+if (!this.filterable || !this.sidebarState.filter) {- return this.links;+ return links;}if (this.text?.toLowerCase()?.match(this.sidebarState.sanitizedFilter)) {- return this.links;+ return links;}- return this.links.filter((link) => {+ return links.filter((link) => {return (link.text.toString()@@ -91,11 +104,18 @@ function prepareSidebarSectionClass(Section, routerService) {@cachedget activeLink() {- return findActiveLink(this.filteredLinks, routerService);+ return findActiveLink(+ [...this.filteredLinks, ...(this.filteredMoreLinks || [])],+ routerService+ );}get filtered() {- return !this.filterable || this.filteredLinks?.length > 0;+ return (+ !this.filterable ||+ this.filteredLinks?.length > 0 ||+ this.filteredMoreLinks?.length > 0+ );}};}diff --git a/frontend/discourse/app/components/sidebar/common/custom-section.gjs b/frontend/discourse/app/components/sidebar/common/custom-section.gjsindex b00fc3ac20a..5c274c565b5 100644--- a/frontend/discourse/app/components/sidebar/common/custom-section.gjs+++ b/frontend/discourse/app/components/sidebar/common/custom-section.gjs@@ -43,7 +43,10 @@ export default class SidebarCustomSection extends Component {@cachedget activeLink() {- return findActiveLink(this.section.links, this.router);+ return findActiveLink(+ [...this.section.links, ...(this.section.moreLinks || [])],+ this.router+ );}get exactUrlMatch() {diff --git a/frontend/discourse/app/components/sidebar/more-section-link.gjs b/frontend/discourse/app/components/sidebar/more-section-link.gjsindex 72cbf47ffb3..ed731c710db 100644--- a/frontend/discourse/app/components/sidebar/more-section-link.gjs+++ b/frontend/discourse/app/components/sidebar/more-section-link.gjs@@ -15,6 +15,7 @@ const SidebarMoreSectionLink = <template>@prefixValue={{@sectionLink.prefixValue}}@query={{@sectionLink.query}}@route={{@sectionLink.route}}+ @scrollIntoView={{@scrollIntoView}}@shouldDisplay={{@sectionLink.shouldDisplay}}@suffixCSSClass={{@sectionLink.suffixCSSClass}}@suffixType={{@sectionLink.suffixType}}diff --git a/frontend/discourse/app/components/sidebar/more-section-links.gjs b/frontend/discourse/app/components/sidebar/more-section-links.gjsindex 087d6152235..6129f1af906 100644--- a/frontend/discourse/app/components/sidebar/more-section-links.gjs+++ b/frontend/discourse/app/components/sidebar/more-section-links.gjs@@ -1,11 +1,14 @@import Component from "@glimmer/component";-import { tracked } from "@glimmer/tracking";+import { cached, tracked } from "@glimmer/tracking";import { fn } from "@ember/helper";import { on } from "@ember/modifier";import { action } from "@ember/object";+import { getOwner } from "@ember/owner";import { service } from "@ember/service";-import { isEmpty } from "@ember/utils";+import curryComponent from "ember-curry-component";import DMenu from "discourse/float-kit/components/d-menu";+import { findActiveLink } from "discourse/lib/sidebar/active-link";+import { and } from "discourse/truth-helpers";import DDropdownMenu from "discourse/ui-kit/d-dropdown-menu";import MoreSectionLink from "./more-section-link";import MoreSectionTrigger from "./more-section-trigger";@@ -27,8 +30,12 @@ export default class SidebarMoreSectionLinks extends Component {this.router.off("routeDidChange", this, this.#setActiveSectionLink);}+ get hoistActiveLink() {+ return this.args.hoistActiveLink ?? true;+ }+get sectionLinks() {- if (this.activeSectionLink) {+ if (this.hoistActiveLink && this.activeSectionLink) {return this.#filterActiveSectionLink(this.args.sectionLinks);} else {return this.args.sectionLinks;@@ -36,7 +43,7 @@ export default class SidebarMoreSectionLinks extends Component {}get secondarySectionLinks() {- if (this.activeSectionLink) {+ if (this.hoistActiveLink && this.activeSectionLink) {return this.#filterActiveSectionLink(this.args.secondarySectionLinks);} else {return this.args.secondarySectionLinks;@@ -50,21 +57,25 @@ export default class SidebarMoreSectionLinks extends Component {}#setActiveSectionLink() {- this.activeSectionLink = this.args.sectionLinks.find((sectionLink) => {- const args = [sectionLink.route];-- if (sectionLink.model) {- args.push(sectionLink.model);- } else if (sectionLink.models) {- args.push(...sectionLink.models);- }-- if (!isEmpty(sectionLink.query)) {- args.push({ queryParams: sectionLink.query });- }+ this.activeSectionLink = findActiveLink(+ this.args.sectionLinks,+ this.router+ );+ }- return this.router.isActive(...args) && sectionLink;- });+ @cached+ get triggerComponent() {+ return curryComponent(+ MoreSectionTrigger,+ {+ text: this.args.triggerText,+ prefixType: this.args.triggerPrefixType,+ prefixValue: this.args.triggerPrefixValue,+ suffixType: this.args.triggerSuffixType,+ suffixValue: this.args.triggerSuffixValue,+ },+ getOwner(this)+ );}@action@@ -77,8 +88,11 @@ export default class SidebarMoreSectionLinks extends Component {}<template>- {{#if this.activeSectionLink}}- <MoreSectionLink @sectionLink={{this.activeSectionLink}} />+ {{#if (and this.hoistActiveLink this.activeSectionLink)}}+ <MoreSectionLink+ @sectionLink={{this.activeSectionLink}}+ @scrollIntoView={{@scrollActiveLinkIntoView}}+ />{{/if}}<li class="sidebar-section-link-wrapper">@@ -88,8 +102,8 @@ export default class SidebarMoreSectionLinks extends Component {@autofocus={{true}}@placement="bottom"@inline={{true}}- @identifier="sidebar-more-section"- @triggerComponent={{MoreSectionTrigger}}+ @identifier={{if @identifier @identifier "sidebar-more-section"}}+ @triggerComponent={{this.triggerComponent}}><:content as |menu|>diff --git a/frontend/discourse/app/components/sidebar/more-section-trigger.gjs b/frontend/discourse/app/components/sidebar/more-section-trigger.gjsindex 15c8c7de79b..f267181178b 100644--- a/frontend/discourse/app/components/sidebar/more-section-trigger.gjs+++ b/frontend/discourse/app/components/sidebar/more-section-trigger.gjs@@ -1,14 +1,34 @@+import { eq, or } from "discourse/truth-helpers";+import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";import dIcon from "discourse/ui-kit/helpers/d-icon";import { i18n } from "discourse-i18n";+import SectionLinkPrefix from "./section-link-prefix";const MoreSectionTrigger = <template><button ...attributes type="button" class="sidebar-section-link sidebar-row">- <span class="sidebar-section-link-prefix icon">- {{dIcon "ellipsis-vertical"}}- </span>+ <SectionLinkPrefix+ @prefixType={{or @prefixType "icon"}}+ @prefixValue={{or @prefixValue "ellipsis-vertical"}}+ @prefixCSSClass={{@prefixCSSClass}}+ />+<span class="sidebar-section-link-content-text">- {{i18n "sidebar.more"}}+ {{or @text (i18n "sidebar.more")}}</span>++ {{#if @suffixValue}}+ <span+ class={{dConcatClass+ "sidebar-section-link-suffix"+ @suffixType+ @suffixCSSClass+ }}+ >+ {{#if (eq @suffixType "icon")}}+ {{dIcon @suffixValue}}+ {{/if}}+ </span>+ {{/if}}</button></template>;diff --git a/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section.js b/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section.jsindex be057c512e0..2fe5b622bd5 100644--- a/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section.js+++ b/frontend/discourse/app/lib/sidebar/base-custom-sidebar-section.js@@ -31,6 +31,73 @@ export default class BaseCustomSidebarSection {*/get links() {}+ /**+ * Links rendered behind a "more" drawer instead of directly in the section,+ * matching the drawer the community section uses.+ *+ * @returns {BaseCustomSidebarSectionLink[]} Links for the drawer+ */+ get moreLinks() {+ return [];+ }++ /**+ * @returns {string} Text for the drawer trigger. Defaults to "More…".+ */+ get moreLinksTriggerText() {}++ /**+ * @returns {string} Prefix type for the drawer trigger, matching a section+ * link's. Accepted values: icon, image, text, emoji, square.+ */+ get moreLinksTriggerPrefixType() {}++ /**+ * @returns {string} Prefix value for the drawer trigger. Defaults to an+ * ellipsis icon.+ */+ get moreLinksTriggerPrefixValue() {}++ /**+ * @returns {string} Suffix type for the drawer trigger. Accepted value: icon.+ */+ get moreLinksTriggerSuffixType() {}++ /**+ * @returns {string} Suffix value for the drawer trigger, e.g. a chevron when+ * the trigger reads as a picker.+ */+ get moreLinksTriggerSuffixValue() {}++ /**+ * Renders the drawer's links directly in the section instead of behind the+ * trigger, for a section that wants them listed but kept apart from its own+ * links.+ *+ * @returns {boolean} Defaults to false.+ */+ get moreLinksInline() {+ return false;+ }++ /**+ * Whether the drawer's active link is lifted out and rendered above the+ * trigger. Turn this off when the trigger itself names the current choice.+ *+ * @returns {boolean} Defaults to true.+ */+ get moreLinksHoistActiveLink() {+ return true;+ }++ /**+ * @returns {"start"|"end"} Whether the drawer leads or trails the section's+ * own links. Defaults to "end".+ */+ get moreLinksPosition() {+ return "end";+ }+/*** @returns {Boolean} Whether or not to show the entire section including heading.*/diff --git a/frontend/discourse/tests/acceptance/sidebar-plugin-api-test.gjs b/frontend/discourse/tests/acceptance/sidebar-plugin-api-test.gjsindex 892f6793e03..64c2f4efe94 100644--- a/frontend/discourse/tests/acceptance/sidebar-plugin-api-test.gjs+++ b/frontend/discourse/tests/acceptance/sidebar-plugin-api-test.gjs@@ -284,6 +284,249 @@ acceptance("Sidebar - Plugin API", function (needs) {);});+ test("A section without moreLinks renders no drawer", async function (assert) {+ withPluginApi((api) => {+ api.addSidebarSection(+ (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {+ return class extends BaseCustomSidebarSection {+ name = "test-plain-section";+ text = "plain section text";++ links = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "plain-link";+ route = "discovery.latest";+ title = "plain link title";+ text = "plain link text";+ })(),+ ];+ };+ }+ );+ });++ await visit("/");++ assert+ .dom(".sidebar-section[data-section-name='test-plain-section']")+ .exists();++ assert+ .dom(+ ".sidebar-section[data-section-name='test-plain-section'] .sidebar-more-section-links-details-summary"+ )+ .doesNotExist("no drawer trigger is added to sections that opt out");+ });++ test("Links behind a more drawer", async function (assert) {+ withPluginApi((api) => {+ api.addSidebarSection(+ (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {+ return class extends BaseCustomSidebarSection {+ name = "test-inboxes";+ text = "inboxes text";+ moreLinksTriggerText = "Pick an inbox";+ moreLinksTriggerPrefixType = "icon";+ moreLinksTriggerPrefixValue = "inbox";+ moreLinksTriggerSuffixType = "icon";+ moreLinksTriggerSuffixValue = "chevron-down";++ links = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "always-shown";+ route = "discovery.latest";+ title = "always shown title";+ text = "always shown text";+ })(),+ ];++ moreLinks = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "tucked-away";+ route = "discovery.unread";+ title = "tucked away title";+ text = "tucked away text";+ })(),+ ];+ };+ }+ );+ });++ await visit("/");++ assert+ .dom(".sidebar-section[data-section-name='test-inboxes']")+ .exists("the section is rendered");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-inboxes'] [data-link-name='tucked-away']"+ )+ .doesNotExist("drawer links are not rendered inline");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-inboxes'] .sidebar-more-section-links-details-summary"+ )+ .hasText("Pick an inbox", "the trigger uses the section's text");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-inboxes'] .sidebar-section-link-prefix .d-icon-inbox"+ )+ .exists("the trigger takes a prefix like a section link does");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-inboxes'] .sidebar-section-link-suffix .d-icon-chevron-down"+ )+ .exists("and a suffix");++ await click(+ ".sidebar-section[data-section-name='test-inboxes'] .sidebar-more-section-links-details-summary"+ );++ assert+ .dom("[data-link-name='tucked-away']")+ .exists("the drawer reveals its links");+ });++ test("A more drawer copes with links that only carry an href", async function (assert) {+ withPluginApi((api) => {+ api.addSidebarSection(+ (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {+ return class extends BaseCustomSidebarSection {+ name = "test-href-drawer";+ text = "href drawer text";++ links = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "always-shown";+ route = "discovery.latest";+ title = "always shown title";+ text = "always shown text";+ })(),+ ];++ moreLinks = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "external";+ href = "https://www.discourse.org";+ title = "External";+ text = "External";+ })(),+ ];+ };+ }+ );+ });++ await visit("/");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-href-drawer'] .sidebar-more-section-links-details-summary"+ )+ .exists("the section renders rather than throwing");++ await click(+ ".sidebar-section[data-section-name='test-href-drawer'] .sidebar-more-section-links-details-summary"+ );++ assert+ .dom("[data-link-name='external']")+ .exists("and the href-only link is listed");+ });++ test("A more drawer can be inlined by the section", async function (assert) {+ withPluginApi((api) => {+ api.addSidebarSection(+ (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {+ return class extends BaseCustomSidebarSection {+ name = "test-inlined-drawer";+ text = "inlined drawer text";+ moreLinksInline = true;++ links = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "always-shown";+ route = "discovery.latest";+ title = "always shown title";+ text = "always shown text";+ })(),+ ];++ moreLinks = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "listed-inline";+ route = "discovery.unread";+ title = "listed inline title";+ text = "listed inline text";+ })(),+ ];+ };+ }+ );+ });++ await visit("/");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-inlined-drawer'] [data-link-name='listed-inline']"+ )+ .exists("the links are rendered in the section");++ assert+ .dom(+ ".sidebar-section[data-section-name='test-inlined-drawer'] .sidebar-more-section-links-details-summary"+ )+ .doesNotExist("and there is no trigger to open");+ });++ test("A more drawer can lead the section", async function (assert) {+ withPluginApi((api) => {+ api.addSidebarSection(+ (BaseCustomSidebarSection, BaseCustomSidebarSectionLink) => {+ return class extends BaseCustomSidebarSection {+ name = "test-leading-drawer";+ text = "leading drawer text";+ moreLinksPosition = "start";++ links = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "second-item";+ route = "discovery.latest";+ title = "second item title";+ text = "second item text";+ })(),+ ];++ moreLinks = [+ new (class extends BaseCustomSidebarSectionLink {+ name = "in-the-drawer";+ route = "discovery.unread";+ title = "in the drawer title";+ text = "in the drawer text";+ })(),+ ];+ };+ }+ );+ });++ await visit("/");++ const rows = [+ ...document.querySelectorAll(+ ".sidebar-section[data-section-name='test-leading-drawer'] .sidebar-section-link-wrapper"+ ),+ ];++ assert.dom(rows[0]).hasText("More", "the drawer trigger is the first row");+ });+test("Single header action and no links", async function (assert) {withPluginApi((api) => {api.addSidebarSection((BaseCustomSidebarSection) => {