A platform for community discussion. Free, open, simple.
DEV: Replace toolbar popup menu with DMenu (#33247)
chapoiebee4df8a114
diff --git a/app/assets/javascripts/discourse/app/components/composer/toolbar-buttons.gjs b/app/assets/javascripts/discourse/app/components/composer/toolbar-buttons.gjsindex 07b8f412b96..d9805ffac13 100644--- a/app/assets/javascripts/discourse/app/components/composer/toolbar-buttons.gjs+++ b/app/assets/javascripts/discourse/app/components/composer/toolbar-buttons.gjs@@ -3,8 +3,8 @@ import { hash } from "@ember/helper";import { action } from "@ember/object";import { eq } from "truth-helpers";import DButton from "discourse/components/d-button";+import ToolbarPopupMenuOptions from "discourse/components/toolbar-popup-menu-options";import concatClass from "discourse/helpers/concat-class";-import ToolbarPopupMenuOptions from "select-kit/components/toolbar-popup-menu-options";export default class ComposerToolbarButtons extends Component {@action@@ -45,7 +45,7 @@ export default class ComposerToolbarButtons extends Component {@tabindex={{this.tabIndex button}}@onKeydown={{this.rovingButtonBar}}@options={{hash icon=button.icon focusAfterOnChange=false}}- class={{button.className}}+ @class={{button.className}}/>{{else}}<DButtondiff --git a/app/assets/javascripts/discourse/app/components/toolbar-popup-menu-options.gjs b/app/assets/javascripts/discourse/app/components/toolbar-popup-menu-options.gjsnew file mode 100644index 00000000000..eef4c8900e6--- /dev/null+++ b/app/assets/javascripts/discourse/app/components/toolbar-popup-menu-options.gjs@@ -0,0 +1,101 @@+import Component from "@glimmer/component";+import { array, concat, fn } from "@ember/helper";+import { action } from "@ember/object";+import { htmlSafe } from "@ember/template";+import DButton from "discourse/components/d-button";+import DropdownMenu from "discourse/components/dropdown-menu";+import concatClass from "discourse/helpers/concat-class";+import icon from "discourse/helpers/d-icon";+import { PLATFORM_KEY_MODIFIER } from "discourse/lib/keyboard-shortcuts";+import { translateModKey } from "discourse/lib/utilities";+import { i18n } from "discourse-i18n";+import DMenu from "float-kit/components/d-menu";++export default class ToolbarPopupmenuOptions extends Component {+ willDestroy() {+ super.willDestroy();+ this.dMenu?.destroy();+ }++ @action+ async onSelect(option) {+ await this.dMenu?.close();+ this.args.onChange?.(option);+ }++ @action+ onRegisterApi(api) {+ this.dMenu = api;+ }++ #convertMenuOption(content) {+ if (content.condition) {+ let label;+ if (content.label) {+ label = i18n(content.label);+ if (content.shortcut) {+ label = htmlSafe(+ `${label} <kbd class="shortcut">${translateModKey(+ PLATFORM_KEY_MODIFIER + "+" + content.shortcut+ )}</kbd>`+ );+ }+ }++ let title = content.title ? i18n(content.title) : label;+ if (content.shortcut) {+ title += ` (${translateModKey(+ PLATFORM_KEY_MODIFIER + "+" + content.shortcut+ )})`;+ }++ return {+ icon: content.icon,+ label,+ title,+ name: content.name,+ action: content.action,+ };+ }+ }++ get convertedContent() {+ return this.args.content.map(this.#convertMenuOption).filter(Boolean);+ }++ <template>+ <DMenu+ @identifier={{concat "toolbar-menu__" @class}}+ @groupIdentifier="toolbar-menu"+ @icon={{@icon}}+ @onRegisterApi={{this.onRegisterApi}}+ @onShow={{@onOpen}}+ @modalForMobile={{true}}+ @placement="bottom"+ @fallbackPlacements={{array "top"}}+ @offset={{5}}+ @onKeydown={{@onKeydown}}+ tabindex="-1"+ class={{concatClass @class}}+ >+ <:trigger>+ {{icon @options.icon}}+ </:trigger>+ <:content>+ <DropdownMenu as |dropdown|>+ {{#each this.convertedContent as |option|}}+ <dropdown.item>+ <DButton+ @translatedLabel={{option.label}}+ @translatedTitle={{option.title}}+ @icon={{option.icon}}+ @action={{fn this.onSelect option}}+ data-name={{option.name}}+ />+ </dropdown.item>+ {{/each}}+ </DropdownMenu>+ </:content>+ </DMenu>+ </template>+}diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.jsindex 2b3ffb6c24b..43376d45697 100644--- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js@@ -707,36 +707,33 @@ import { i18n } from "discourse-i18n";});test("Composer can toggle whispers when whisperer user", async function (assert) {- const menu = selectKit(".toolbar-popup-menu-options");-await visit("/t/this-is-a-test-topic/9");await click(".topic-post[data-post-number='1'] button.reply");- await menu.expand();- await menu.selectRowByName("toggle-whisper");+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='toggle-whisper']");assert.dom(".composer-actions svg.d-icon-far-eye-slash").exists("sets the post type to whisper");- await menu.expand();- await menu.selectRowByName("toggle-whisper");+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='toggle-whisper']");assert.dom(".composer-actions svg.d-icon-far-eye-slash").doesNotExist("removes the whisper mode");- await menu.expand();- await menu.selectRowByName("toggle-whisper");+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='toggle-whisper']");await click(".toggle-fullscreen");- await menu.expand();+ await click(".toolbar-menu__options-trigger");- assert.true(- menu.rowByName("toggle-whisper").exists(),- "whisper toggling is still present when going fullscreen"- );+ assert+ .dom("[data-name='toggle-whisper']")+ .exists("whisper toggling is still present when going fullscreen");});test("Composer can toggle layouts (open, fullscreen and draft)", async function (assert) {@@ -803,11 +800,8 @@ import { i18n } from "discourse-i18n";await visit("/t/this-is-a-test-topic/9");await click(".topic-post[data-post-number='1'] button.reply");- await selectKit(".toolbar-popup-menu-options").expand();-- await selectKit(".toolbar-popup-menu-options").selectRowByName(- "toggle-whisper"- );+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='toggle-whisper']");assert.dom(".composer-actions svg.d-icon-far-eye-slash")@@ -823,10 +817,8 @@ import { i18n } from "discourse-i18n";.dom(".reply-details .whisper .d-icon-far-eye-slash").doesNotExist("should reset the state of the composer's model");- await selectKit(".toolbar-popup-menu-options").expand();- await selectKit(".toolbar-popup-menu-options").selectRowByName(- "toggle-invisible"- );+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='toggle-invisible']");assert.dom(".reply-details .unlist")@@ -1505,10 +1497,9 @@ import { i18n } from "discourse-i18n";.dom(".d-editor-input").hasValue("hello **the** world", "adds the bold");- const dropdown = selectKit(".toolbar-popup-menu-options");- await dropdown.expand();+ await click(".toolbar-menu__options-trigger");- const row = dropdown.rowByName("bold").el();+ const row = find("[data-name='bold']");assert.dom(row).hasAttribute(@@ -1660,22 +1651,22 @@ import { i18n } from "discourse-i18n";assert.dom(".d-editor-input").exists("the composer input is visible");const expectedName = "[en.some_label]";- const dropdown = selectKit(".toolbar-popup-menu-options");- await dropdown.expand();+ await click(".toolbar-menu__options-trigger");- assert.false(- dropdown.rowByName(expectedName).exists(),- "custom button is not displayed for reply"- );+ assert+ .dom(`button[title="${expectedName}"]`)+ .doesNotExist("custom button is not displayed for reply");++ await click(".toolbar-menu__options-trigger");await visit("/latest");await click("#create-topic");- await dropdown.expand();- assert.true(- dropdown.rowByName(expectedName).exists(),- "custom button is displayed for new topic"- );+ await click(".toolbar-menu__options-trigger");++ assert+ .dom(`button[title="${expectedName}"]`)+ .exists("custom button is displayed for new topic");});});diff --git a/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js b/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.jsindex bcec9ba7ec8..a4911f4ebad 100644--- a/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/table-builder-test.js@@ -1,7 +1,6 @@import { click, visit } from "@ember/test-helpers";import { test } from "qunit";import { acceptance } from "discourse/tests/helpers/qunit-helpers";-import selectKit from "discourse/tests/helpers/select-kit-helper";["enabled", "disabled"].forEach((postStreamMode) => {acceptance(@@ -15,11 +14,10 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";test("Can see table builder button when creating a topic", async function (assert) {await visit("/");await click("#create-topic");- await click(".d-editor-button-bar .options");- await selectKit(".toolbar-popup-menu-options").expand();+ await click(".toolbar-menu__options-trigger");assert- .dom(`.select-kit-row[data-name='toggle-spreadsheet']`)+ .dom("button[data-name='toggle-spreadsheet']").exists("it shows the builder button");});@@ -28,11 +26,10 @@ import selectKit from "discourse/tests/helpers/select-kit-helper";await click("#post_1 .show-more-actions");await click("#post_1 .edit");assert.dom("#reply-control").exists();- await click(".d-editor-button-bar .options");- await selectKit(".toolbar-popup-menu-options").expand();+ await click(".toolbar-menu__options-trigger");assert- .dom(`.select-kit-row[data-name='toggle-spreadsheet']`)+ .dom("button[data-name='toggle-spreadsheet']").exists("it shows the builder button");});}diff --git a/app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options.js b/app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options.jsdeleted file mode 100644index d3ed77c8d1a..00000000000--- a/app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options.js+++ /dev/null@@ -1,61 +0,0 @@-import { classNames } from "@ember-decorators/component";-import { PLATFORM_KEY_MODIFIER } from "discourse/lib/keyboard-shortcuts";-import { translateModKey } from "discourse/lib/utilities";-import { i18n } from "discourse-i18n";-import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";-import {- pluginApiIdentifiers,- selectKitOptions,-} from "select-kit/components/select-kit";--@classNames("toolbar-popup-menu-options")-@selectKitOptions({- showFullTitle: false,- filterable: false,- autoFilterable: false,- preventHeaderFocus: true,- customStyle: true,-})-@pluginApiIdentifiers("toolbar-popup-menu-options")-export default class ToolbarPopupMenuOptions extends DropdownSelectBoxComponent {- modifyContent(contents) {- return contents- .map((content) => {- if (content.condition) {- let label;- if (content.label) {- label = i18n(content.label);- if (content.shortcut) {- label += ` <kbd class="shortcut">${translateModKey(- PLATFORM_KEY_MODIFIER + "+" + content.shortcut- )}</kbd>`;- }- }-- let title;- if (content.title) {- title = i18n(content.title);- if (content.shortcut) {- title += ` (${translateModKey(- PLATFORM_KEY_MODIFIER + "+" + content.shortcut- )})`;- }- }-- let name = content.name;- if (!name && content.label) {- name = i18n(content.label);- }-- return {- icon: content.icon,- label,- title,- name,- id: { name: content.name, action: content.action },- };- }- })- .filter(Boolean);- }-}diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scssindex 7aabdb18559..ac22dbd54d8 100644--- a/app/assets/stylesheets/common.scss+++ b/app/assets/stylesheets/common.scss@@ -22,3 +22,4 @@@import "common/login/_index";@import "common/table-builder/_index";@import "common/post-action-feedback";+@import "common/toolbar-popup-menu-options";diff --git a/app/assets/stylesheets/common/float-kit/d-menu.scss b/app/assets/stylesheets/common/float-kit/d-menu.scssindex 7b0ea4420fb..46c303bdef0 100644--- a/app/assets/stylesheets/common/float-kit/d-menu.scss+++ b/app/assets/stylesheets/common/float-kit/d-menu.scss@@ -135,4 +135,15 @@&__divider {margin: 0;}++ .shortcut {+ border: none;+ color: var(--primary-low-mid);+ background: transparent;+ margin-left: 1em;+ margin-right: 0;+ padding: 0;+ font-family: var(--font-family);+ font-weight: bold;+ }}diff --git a/app/assets/stylesheets/common/select-kit/_index.scss b/app/assets/stylesheets/common/select-kit/_index.scssindex f4aa90dd3bd..de03e0e8c49 100644--- a/app/assets/stylesheets/common/select-kit/_index.scss+++ b/app/assets/stylesheets/common/select-kit/_index.scss@@ -22,7 +22,6 @@@import "single-select";@import "tag-chooser";@import "tag-drop";-@import "toolbar-popup-menu-options";@import "topic-chooser";@import "topic-notifications-button";@import "user-row";diff --git a/app/assets/stylesheets/common/select-kit/toolbar-popup-menu-options.scss b/app/assets/stylesheets/common/select-kit/toolbar-popup-menu-options.scssdeleted file mode 100644index 8bd839188eb..00000000000--- a/app/assets/stylesheets/common/select-kit/toolbar-popup-menu-options.scss+++ /dev/null@@ -1,63 +0,0 @@-.select-kit {- &.dropdown-select-box {- &.toolbar-popup-menu-options {- .select-kit-collection {- max-height: 35vh;- }-- .select-kit-body {- box-shadow: none;- border-radius: 0;- }-- .select-kit-row {- padding: 0.65em 0.5em;- border-bottom: 1px solid rgb(var(--primary-low-rgb), 0.5);- display: flex;- align-items: center;-- // popup-menu doesn't use description text atm- // it's just easier to align the icon with text then- .icons {- align-self: center;- }-- .shortcut {- border: none;- background: var(--primary-200);- font-size: var(--font-down-2);- color: var(--primary-high);- margin-left: 1.8rem;- font-family: var(--font-family);- font-weight: bold;- }-- &:last-child {- border: none;- }-- .texts .name {- display: flex;- align-items: center;- }-- .texts .name,- .icons .d-icon {- font-size: var(--font-0);- font-weight: normal;- }-- .d-icon {- color: var(--primary-medium);- }-- &.is-highlighted,- &.is-selected,- &:hover {- background: var(--tertiary-low);- color: var(--primary);- }- }- }- }-}diff --git a/app/assets/stylesheets/common/toolbar-popup-menu-options.scss b/app/assets/stylesheets/common/toolbar-popup-menu-options.scssnew file mode 100644index 00000000000..c2c084f84e4--- /dev/null+++ b/app/assets/stylesheets/common/toolbar-popup-menu-options.scss@@ -0,0 +1,13 @@+@use "lib/viewport";++.toolbar-menu__options-content {+ @include viewport.from(sm) {+ z-index: z("composer", "content");+ }++ .shortcut {+ @include viewport.until(sm) {+ display: none;+ }+ }+}diff --git a/app/assets/stylesheets/mobile/select-kit/_index.scss b/app/assets/stylesheets/mobile/select-kit/_index.scssindex 6c9ea8193c3..2327d21b0fc 100644--- a/app/assets/stylesheets/mobile/select-kit/_index.scss+++ b/app/assets/stylesheets/mobile/select-kit/_index.scss@@ -2,4 +2,3 @@@import "dropdown-select-box";@import "select-kit";@import "tag-drop";-@import "toolbar-popup-menu-options";diff --git a/app/assets/stylesheets/mobile/select-kit/toolbar-popup-menu-options.scss b/app/assets/stylesheets/mobile/select-kit/toolbar-popup-menu-options.scssdeleted file mode 100644index abdc66b85bc..00000000000--- a/app/assets/stylesheets/mobile/select-kit/toolbar-popup-menu-options.scss+++ /dev/null@@ -1,16 +0,0 @@-// ensure popupmenu options has scroll behavior on limited screen space-#reply-control {- &.composer-action-createTopic {- .toolbar-popup-menu-options .select-kit-collection {- // fits popup menu inside textarea in create topic composer- max-height: 155px;- }- }-- &.composer-action-reply {- .toolbar-popup-menu-options .select-kit-collection {- // fits popup menu to textarea in reply composer- max-height: 230px;- }- }-}diff --git a/plugins/discourse-details/spec/system/details_spec.rb b/plugins/discourse-details/spec/system/details_spec.rbindex c21ccaadeb8..a68d27f4cb6 100644--- a/plugins/discourse-details/spec/system/details_spec.rb+++ b/plugins/discourse-details/spec/system/details_spec.rb@@ -15,8 +15,8 @@ describe "Details button", type: :system doit "uses the text selection for content" dovisit("/new-topic")composer.fill_content("test :+1:").toggle_rich_editor.select_all- find(".toolbar-popup-menu-options").click- find(".select-kit-row[data-name='Hide Details']").click+ find(".toolbar-menu__options-trigger").click+ find("button[title='Hide Details']").clickrich.click(x: 22, y: 30) # hack for pseudo elementexpect(rich).to have_css(diff --git a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.jsindex e3ecc397fbd..d3843711591 100644--- a/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js+++ b/plugins/discourse-details/test/javascripts/acceptance/details-button-test.js@@ -8,16 +8,14 @@ acceptance("Details Button", function (needs) {needs.user();test("details button", async function (assert) {- const popupMenu = selectKit(".toolbar-popup-menu-options");-await visit("/");await click("#create-topic");const categoryChooser = selectKit(".category-chooser");await categoryChooser.expand();await categoryChooser.selectRowByValue(2);- await popupMenu.expand();- await popupMenu.selectRowByName(i18n("details.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("details.title")}"]`);assert.dom(".d-editor-input")@@ -34,8 +32,8 @@ acceptance("Details Button", function (needs) {textarea.selectionStart = 0;textarea.selectionEnd = textarea.value.length;- await popupMenu.expand();- await popupMenu.selectRowByName(i18n("details.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("details.title")}"]`);assert.dom(".d-editor-input")@@ -62,8 +60,8 @@ acceptance("Details Button", function (needs) {textarea.selectionStart = 7;textarea.selectionEnd = 28;- await popupMenu.expand();- await popupMenu.selectRowByName(i18n("details.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("details.title")}"]`);assert.dom(".d-editor-input")@@ -90,8 +88,8 @@ acceptance("Details Button", function (needs) {textarea.selectionStart = 8;textarea.selectionEnd = 29;- await popupMenu.expand();- await popupMenu.selectRowByName(i18n("details.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("details.title")}"]`);assert.dom(".d-editor-input")@@ -116,7 +114,6 @@ acceptance("Details Button", function (needs) {test("details button surrounds all selected text in a single details block", async function (assert) {const multilineInput = "first line\n\nsecond line\n\nthird line";- const popupMenu = selectKit(".toolbar-popup-menu-options");await visit("/");await click("#create-topic");@@ -129,8 +126,8 @@ acceptance("Details Button", function (needs) {textarea.selectionStart = 0;textarea.selectionEnd = textarea.value.length;- await popupMenu.expand();- await popupMenu.selectRowByName(i18n("details.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("details.title")}"]`);assert.dom(".d-editor-input")diff --git a/plugins/discourse-local-dates/spec/system/local_dates_spec.rb b/plugins/discourse-local-dates/spec/system/local_dates_spec.rbindex 7be53475454..a096be28925 100644--- a/plugins/discourse-local-dates/spec/system/local_dates_spec.rb+++ b/plugins/discourse-local-dates/spec/system/local_dates_spec.rb@@ -86,8 +86,8 @@ describe "Local dates", type: :system doit "allows selecting a date without a time and inserts into the post" dotopic_page.visit_topic_and_open_composer(topic)expect(topic_page).to have_expanded_composer- find(".d-editor-button-bar .toolbar-popup-menu-options").click- page.find(".toolbar-popup-menu-options [data-name=local-dates]").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name=local-dates]").clickexpect(insert_datetime_modal).to be_openinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(16)@@ -100,8 +100,8 @@ describe "Local dates", type: :system doit "allows selecting a date with a time and inserts into the post" dotopic_page.visit_topic_and_open_composer(topic)expect(topic_page).to have_expanded_composer- find(".d-editor-button-bar .toolbar-popup-menu-options").click- page.find(".toolbar-popup-menu-options [data-name=local-dates]").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name=local-dates]").clickexpect(insert_datetime_modal).to be_openinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(16)@@ -116,8 +116,8 @@ describe "Local dates", type: :system doit "allows selecting a start date and time and an end date and time" dotopic_page.visit_topic_and_open_composer(topic)expect(topic_page).to have_expanded_composer- find(".d-editor-button-bar .toolbar-popup-menu-options").click- page.find(".toolbar-popup-menu-options [data-name=local-dates]").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name=local-dates]").clickexpect(insert_datetime_modal).to be_openinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(16)@@ -139,8 +139,8 @@ describe "Local dates", type: :system doexpect(topic_page).to have_expanded_composer- find(".d-editor-button-bar .toolbar-popup-menu-options").click- page.find(".toolbar-popup-menu-options [data-name=local-dates]").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name=local-dates]").clickexpect(insert_datetime_modal).to be_opendiff --git a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.jsindex e436bfc519b..4434551b0f1 100644--- a/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js+++ b/plugins/discourse-local-dates/test/javascripts/acceptance/local-dates-composer-test.js@@ -78,9 +78,8 @@ acceptance("Local Dates - composer", function (needs) {const categoryChooser = selectKit(".category-chooser");await categoryChooser.expand();await categoryChooser.selectRowByValue(2);- const optionsMenu = selectKit(".toolbar-popup-menu-options");- await optionsMenu.expand();- await optionsMenu.selectRowByName("local-dates");+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='local-dates']");const timezoneChooser = selectKit(".timezone-input");await timezoneChooser.expand();@@ -97,9 +96,8 @@ acceptance("Local Dates - composer", function (needs) {const categoryChooser = selectKit(".category-chooser");await categoryChooser.expand();await categoryChooser.selectRowByValue(2);- const optionsMenu = selectKit(".toolbar-popup-menu-options");- await optionsMenu.expand();- await optionsMenu.selectRowByName("local-dates");+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='local-dates']");await click('.pika-table td[data-day="5"] > .pika-button');diff --git a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.jsindex 96bada44ce5..465e90ae180 100644--- a/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js+++ b/plugins/discourse-presence/test/javascripts/acceptance/discourse-presence-test.js@@ -75,9 +75,8 @@ acceptance("Discourse Presence Plugin", function (needs) {"publishes reply presence when typing");- const menu = selectKit(".toolbar-popup-menu-options");- await menu.expand();- await menu.selectRowByName("toggle-whisper");+ await click(".toolbar-menu__options-trigger");+ await click("[data-name='toggle-whisper']");assert.dom(".composer-actions svg.d-icon-far-eye-slash")diff --git a/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js b/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.jsindex d38bcb946ec..5a4559eb90f 100644--- a/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js+++ b/plugins/poll/test/javascripts/acceptance/poll-builder-enabled-test.js@@ -25,7 +25,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {await displayPollBuilderButton();- const pollBuilderButtonSelector = `.select-kit-row[data-name='${i18n(+ const pollBuilderButtonSelector = `button[title='${i18n("poll.ui_builder.title")}']`;@@ -61,7 +61,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {await displayPollBuilderButton();assert- .dom(".select-kit-row[data-value='showPollBuilder']")+ .dom(`button[title='${i18n("poll.ui_builder.title")}']`).doesNotExist("hides the builder button");});@@ -71,7 +71,7 @@ acceptance("Poll Builder - polls are enabled", function (needs) {await displayPollBuilderButton();assert- .dom(`.select-kit-row[data-name='${i18n("poll.ui_builder.title")}']`)+ .dom(`button[title='${i18n("poll.ui_builder.title")}']`).exists("it shows the builder button");});});diff --git a/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js b/plugins/poll/test/javascripts/helpers/display-poll-builder-button.jsindex 1780280f67d..51c4655efe9 100644--- a/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js+++ b/plugins/poll/test/javascripts/helpers/display-poll-builder-button.js@@ -1,9 +1,7 @@import { click, visit } from "@ember/test-helpers";-import selectKit from "discourse/tests/helpers/select-kit-helper";export async function displayPollBuilderButton() {await visit("/");await click("#create-topic");- await click(".d-editor-button-bar .options");- await selectKit(".toolbar-popup-menu-options").expand();+ await click(".toolbar-menu__options-trigger");}diff --git a/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js b/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.jsindex 76dc614d6c2..eec1ea47d20 100644--- a/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js+++ b/plugins/spoiler-alert/test/javascripts/acceptance/spoiler-button-test.js@@ -9,8 +9,6 @@ acceptance("Spoiler Button", function (needs) {needs.settings({ spoiler_enabled: true });test("spoiler button", async (assert) => {- const popUpMenu = selectKit(".toolbar-popup-menu-options");-await visit("/");assert.dom("#create-topic").exists("the create button is visible");@@ -19,8 +17,8 @@ acceptance("Spoiler Button", function (needs) {const categoryChooser = selectKit(".category-chooser");await categoryChooser.expand();await categoryChooser.selectRowByValue(2);- await popUpMenu.expand();- await popUpMenu.selectRowByName(i18n("spoiler.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("spoiler.title")}"]`);assert.dom(".d-editor-input")@@ -50,8 +48,8 @@ acceptance("Spoiler Button", function (needs) {textarea.selectionStart = 0;textarea.selectionEnd = textarea.value.length;- await popUpMenu.expand();- await popUpMenu.selectRowByName(i18n("spoiler.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("spoiler.title")}"]`);assert.dom(".d-editor-input")@@ -80,8 +78,8 @@ acceptance("Spoiler Button", function (needs) {textarea.selectionStart = 7;textarea.selectionEnd = 21;- await popUpMenu.expand();- await popUpMenu.selectRowByName(i18n("spoiler.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("spoiler.title")}"]`);assert.dom(".d-editor-input")@@ -110,8 +108,8 @@ acceptance("Spoiler Button", function (needs) {textarea.selectionStart = 7;textarea.selectionEnd = 21;- await popUpMenu.expand();- await popUpMenu.selectRowByName(i18n("spoiler.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("spoiler.title")}"]`);assert.dom(".d-editor-input")@@ -141,8 +139,8 @@ acceptance("Spoiler Button", function (needs) {textarea.selectionStart = 7;textarea.selectionEnd = 22;- await popUpMenu.expand();- await popUpMenu.selectRowByName(i18n("spoiler.title"));+ await click(".toolbar-menu__options-trigger");+ await click(`button[title="${i18n("spoiler.title")}"]`);assert.dom(".d-editor-input")diff --git a/spec/system/table_builder_spec.rb b/spec/system/table_builder_spec.rbindex bf7dc3701d8..cdeb8d30641 100644--- a/spec/system/table_builder_spec.rb+++ b/spec/system/table_builder_spec.rb@@ -36,8 +36,8 @@ describe "Table Builder", type: :system doit "should add table items created in spreadsheet to composer input" dovisit("/latest")page.find("#create-topic").click- page.find(".toolbar-popup-menu-options").click- page.find(".select-kit-row[data-name='toggle-spreadsheet']").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name='toggle-spreadsheet']").clickinsert_table_modal.type_in_cell(0, 0, "Item 1")insert_table_modal.type_in_cell(0, 1, "Item 2")insert_table_modal.type_in_cell(0, 2, "Item 3")@@ -64,8 +64,8 @@ describe "Table Builder", type: :system doit "should close the modal if there are no changes made" dovisit("/latest")page.find("#create-topic").click- page.find(".toolbar-popup-menu-options").click- page.find(".select-kit-row[data-name='toggle-spreadsheet']").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name='toggle-spreadsheet']").clickinsert_table_modal.cancelexpect(page).to have_no_css(".insert-table-modal")end@@ -73,8 +73,8 @@ describe "Table Builder", type: :system doit "should show a warning popup if there are unsaved changes" dovisit("/latest")page.find("#create-topic").click- page.find(".toolbar-popup-menu-options").click- page.find(".select-kit-row[data-name='toggle-spreadsheet']").click+ find(".toolbar-menu__options-trigger").click+ page.find("button[data-name='toggle-spreadsheet']").clickinsert_table_modal.type_in_cell(0, 0, "Item 1")insert_table_modal.cancelexpect(page).to have_css(".dialog-container .dialog-content")