FIX: Bulk (glimmer) topic selection on mobile (#28100)

`/t/-/134051`
This commit is contained in:
Jarek Radosz 2024-07-26 21:16:19 +02:00 committed by GitHub
parent b55f2a6270
commit e627d24c3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 3 deletions

View File

@ -432,6 +432,8 @@ export default class TopicListItem extends Component {
{{#if @bulkSelectEnabled}} {{#if @bulkSelectEnabled}}
<label for="bulk-select-{{@topic.id}}"> <label for="bulk-select-{{@topic.id}}">
<input <input
{{on "click" this.onBulkSelectToggle}}
checked={{this.isSelected}}
type="checkbox" type="checkbox"
id="bulk-select-{{@topic.id}}" id="bulk-select-{{@topic.id}}"
class="bulk-select" class="bulk-select"

View File

@ -2,13 +2,12 @@
describe "glimmer topic list", type: :system do describe "glimmer topic list", type: :system do
fab!(:user) fab!(:user)
fab!(:group) { Fabricate(:group, users: [user]) }
let(:topic_list) { PageObjects::Components::TopicList.new } let(:topic_list) { PageObjects::Components::TopicList.new }
let(:topic_page) { PageObjects::Pages::Topic.new } let(:topic_page) { PageObjects::Pages::Topic.new }
before do before do
SiteSetting.experimental_glimmer_topic_list_groups = group.name SiteSetting.experimental_glimmer_topic_list_groups = Group::AUTO_GROUPS[:everyone]
sign_in(user) sign_in(user)
end end
@ -23,7 +22,7 @@ describe "glimmer topic list", type: :system do
describe "/new" do describe "/new" do
it "shows the list and the toggle buttons" do it "shows the list and the toggle buttons" do
SiteSetting.experimental_new_new_view_groups = group.name SiteSetting.experimental_new_new_view_groups = Group::AUTO_GROUPS[:everyone]
Fabricate(:topic) Fabricate(:topic)
Fabricate(:new_reply_topic, current_user: user) Fabricate(:new_reply_topic, current_user: user)
@ -99,4 +98,34 @@ describe "glimmer topic list", type: :system do
topic_list.has_highlighted_topic?(topic) topic_list.has_highlighted_topic?(topic)
end end
end end
describe "bulk topic selection" do
fab!(:user) { Fabricate(:moderator) }
it "shows the buttons and checkboxes" do
topics = Fabricate.times(2, :topic)
visit("/latest")
find("button.bulk-select").click
expect(topic_list).to have_topic_checkbox(topics.first)
expect(page).to have_no_css("button.bulk-select-topics-dropdown-trigger")
topic_list.click_topic_checkbox(topics.first)
expect(page).to have_css("button.bulk-select-topics-dropdown-trigger")
end
context "when on mobile", mobile: true do
it "shows the buttons and checkboxes" do
topics = Fabricate.times(2, :topic)
visit("/latest")
find("button.bulk-select").click
expect(topic_list).to have_topic_checkbox(topics.first)
expect(page).to have_no_css("button.bulk-select-topics-dropdown-trigger")
topic_list.click_topic_checkbox(topics.first)
expect(page).to have_css("button.bulk-select-topics-dropdown-trigger")
end
end
end
end end