mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 04:13:53 +08:00
FEATURE: add drafts dropdown menu (#30277)
This change adds a new dropdown trigger next to the "New Topic" button. When clicked a menu will display a list of topic/post drafts that can be clicked to resume the draft within the composer. The "New Topic" button will no longer change text to show "Open Draft" when a draft topic exists, it will still attempt to load the existing draft if one exists (this will change later when we support multiple drafts in a separate PR). The "My Posts" link in desktop sidebar will now be "My Drafts" and only appear when the current user has existing drafts.
This commit is contained in:
37
spec/system/page_objects/components/drafts_menu.rb
Normal file
37
spec/system/page_objects/components/drafts_menu.rb
Normal file
@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PageObjects
|
||||
module Components
|
||||
class DraftsMenu < PageObjects::Components::Base
|
||||
MENU_SELECTOR = ".topic-drafts-menu"
|
||||
|
||||
def visible?
|
||||
has_css?(MENU_SELECTOR + "-trigger")
|
||||
end
|
||||
|
||||
def hidden?
|
||||
has_no_css?(MENU_SELECTOR + "-trigger")
|
||||
end
|
||||
|
||||
def open?
|
||||
has_css?(MENU_SELECTOR + "-content")
|
||||
end
|
||||
|
||||
def closed?
|
||||
has_no_css?(MENU_SELECTOR + "-content")
|
||||
end
|
||||
|
||||
def open
|
||||
find(MENU_SELECTOR + "-trigger").click
|
||||
end
|
||||
|
||||
def draft_item_count
|
||||
all(MENU_SELECTOR + "-content .topic-drafts-item").size
|
||||
end
|
||||
|
||||
def other_drafts_count
|
||||
find(MENU_SELECTOR + "-content .view-all-drafts span:first-child")["data-other-drafts"].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user