mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 13:19:19 +08:00
The setting has been hidden and enabled by default since it was switched on for all sites in mid-2025, making it effectively dead configuration. The rich editor is now always available, and the per-user `composition_mode` preference remains the only way to pick between the markdown and rich text editors. This also makes the first toolbar button focusable when a `composer-force-editor-mode` transformer hides the editor mode toggle, which previously left the toolbar without a tabbable button in that state. Since it comes from the same rollout, this also drops the shim that migrated the pre-`composition_mode` localStorage preference (`d-editor-prefers-rich-editor`) into the user option. The key hasn't been written since the rich editor was enabled everywhere a year ago, and the shim deleted it on first composer open, so any remaining copies belong to browsers that haven't composed since then — for those, the default mode is rich anyway.
33 lines
1,018 B
Ruby
Vendored
33 lines
1,018 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
describe "Composer - Event preview focus" do
|
|
fab!(:admin)
|
|
|
|
let(:composer) { PageObjects::Components::Composer.new }
|
|
|
|
before do
|
|
SiteSetting.calendar_enabled = true
|
|
SiteSetting.discourse_post_event_enabled = true
|
|
sign_in(admin)
|
|
end
|
|
|
|
it "keeps the topic title focused on the first click after editing the event preview" do
|
|
visit("/new-topic")
|
|
|
|
find(".toolbar-menu__options-trigger").click
|
|
click_button(I18n.t("js.discourse_post_event.builder_modal.attach"))
|
|
|
|
expect(page).to have_css(".d-editor-preview .composer-event-editor")
|
|
|
|
find(".composer-event-editor .composer-event__name-input").fill_in(with: "My offsite")
|
|
|
|
find("#reply-title").click
|
|
|
|
title_focused =
|
|
page.evaluate_script("document.activeElement === document.querySelector('#reply-title')")
|
|
expect(title_focused).to eq(true)
|
|
|
|
# the edit is still committed even though focus never moved to the editor
|
|
expect(composer).to have_value(/name="My offsite"/)
|
|
end
|
|
end
|