mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 10:24:13 +08:00
DEV: Introduce <DPageHeader /> and <DPageSubheader /> components (#30146)
This converts the `<AdminPageHeader />` component and the `<AdminPageSubheader />` components into new components that can be used outside of admin, and updates the CSS classes. Also introduces a `<DPageActionButton />` component and child components for the header action buttons. I have to keep the old admin-only components around for now until plugins are updated, then we can remove it, and remove the re-exports that are done within admin-page-action-button.gjs
This commit is contained in:
@ -2,17 +2,18 @@
|
||||
|
||||
module PageObjects
|
||||
module Components
|
||||
# TODO (martin) Delete this after plugins have been updated to use DPageHeader
|
||||
class AdminHeader < PageObjects::Pages::Base
|
||||
def has_tabs?(names)
|
||||
expect(page.all(".admin-nav-submenu__tabs a").map(&:text)).to eq(names)
|
||||
expect(page.all(".d-nav-submenu__tabs a").map(&:text)).to eq(names)
|
||||
end
|
||||
|
||||
def visible?
|
||||
has_css?(".admin-page-header")
|
||||
has_css?(".d-page-header")
|
||||
end
|
||||
|
||||
def hidden?
|
||||
has_no_css?(".admin-page-header")
|
||||
has_no_css?(".d-page-header")
|
||||
end
|
||||
end
|
||||
end
|
19
spec/system/page_objects/components/d_page_header.rb
Normal file
19
spec/system/page_objects/components/d_page_header.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module PageObjects
|
||||
module Components
|
||||
class DPageHeader < PageObjects::Pages::Base
|
||||
def has_tabs?(names)
|
||||
expect(page.all(".d-nav-submenu__tabs a").map(&:text)).to eq(names)
|
||||
end
|
||||
|
||||
def visible?
|
||||
has_css?(".d-page-header")
|
||||
end
|
||||
|
||||
def hidden?
|
||||
has_no_css?(".d-page-header")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -21,7 +21,7 @@ module PageObjects
|
||||
end
|
||||
|
||||
def plugin_nav_tab_selector(plugin)
|
||||
".admin-nav-submenu__tabs .admin-plugin-tab-nav-item[data-plugin-nav-tab-id=\"#{plugin}\"]"
|
||||
".d-nav-submenu__tabs .admin-plugin-tab-nav-item[data-plugin-nav-tab-id=\"#{plugin}\"]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,7 +19,7 @@ module PageObjects
|
||||
end
|
||||
|
||||
def click_add_field
|
||||
page.find(".admin-page-header__actions .btn-primary").click
|
||||
page.find(".d-page-header__actions .btn-primary").click
|
||||
end
|
||||
|
||||
def click_edit
|
||||
|
Reference in New Issue
Block a user