A platform for community discussion. Free, open, simple.
FIX: update bookmark UI when using keyboard shortcut (#37639)
Régis Hanol1e9524315e54
diff --git a/frontend/discourse/app/components/topic-footer-buttons.gjs b/frontend/discourse/app/components/topic-footer-buttons.gjsindex 9e9c07db1b9..8a94f22b736 100644--- a/frontend/discourse/app/components/topic-footer-buttons.gjs+++ b/frontend/discourse/app/components/topic-footer-buttons.gjs@@ -66,7 +66,7 @@ export default class TopicFooterButtons extends Component {);}- @computed("topic")+ @computed("topic.bookmarked")get topicBookmarkManager() {return new TopicBookmarkManager(getOwner(this), this.topic);}diff --git a/spec/system/bookmarks_spec.rb b/spec/system/bookmarks_spec.rbindex 5ce8dd90808..0ea591a5c31 100644--- a/spec/system/bookmarks_spec.rb+++ b/spec/system/bookmarks_spec.rb@@ -119,6 +119,21 @@ describe "Bookmarking posts and topics", type: :system do)end+ it "updates the topic status and footer button when using the keyboard shortcut" do+ topic_page.visit_topic(topic)+ expect(topic_page).to have_no_topic_status_bookmark+ expect(topic_page).to have_no_bookmarks(topic)++ send_keys("b")+ expect(bookmark_modal).to be_open+ send_keys(:enter)+ expect(bookmark_modal).to be_closed++ expect(topic_page).to have_topic_status_bookmark+ expect(topic_page).to have_topic_bookmarked(topic)+ expect(Bookmark.exists?(bookmarkable: topic, user: current_user)).to eq(true)+ end+it "bookmark button is topic specific" dotopic_page.visit_topic(topic_2)topic_page.click_topic_bookmark_buttondiff --git a/spec/system/page_objects/pages/topic.rb b/spec/system/page_objects/pages/topic.rbindex 3abc5d84bcb..3ed0e123285 100644--- a/spec/system/page_objects/pages/topic.rb+++ b/spec/system/page_objects/pages/topic.rb@@ -224,6 +224,14 @@ module PageObjectswithin_topic_footer_buttons { has_no_css?(".bookmark-menu-trigger.bookmarked") }end+ def has_topic_status_bookmark?+ has_css?("#topic-title .topic-status.--bookmarked")+ end++ def has_no_topic_status_bookmark?+ has_no_css?("#topic-title .topic-status.--bookmarked")+ end+def click_reply_buttonwithin_topic_footer_buttons { find(".create").click }has_expanded_composer?