mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: the ability to hide the admin header (#30175)
Some pages like new/edit item should not display admin header. New attribute called `@shouldDisplay` was added. As a proof of concept, the flags page was updated.
This commit is contained in:
committed by
GitHub
parent
d69edab611
commit
51a5fa036a
@@ -27,7 +27,7 @@ describe "Admin Flags Page", type: :system do
|
||||
)
|
||||
|
||||
admin_flags_page.visit
|
||||
expect(page).to have_css(".admin-page-header")
|
||||
expect(admin_header).to be_visible
|
||||
|
||||
admin_flags_page.toggle("spam")
|
||||
topic_page.visit_topic(post.topic).open_flag_topic_modal
|
||||
@@ -81,7 +81,9 @@ describe "Admin Flags Page", type: :system do
|
||||
expect(admin_flags_page).to have_add_flag_button_enabled
|
||||
|
||||
admin_flags_page.click_add_flag
|
||||
expect(page).not_to have_css(".admin-page-header")
|
||||
|
||||
expect(admin_header).to be_hidden
|
||||
|
||||
admin_flag_form_page
|
||||
.fill_in_name("Vulgar")
|
||||
.fill_in_description("New flag description")
|
||||
@@ -113,7 +115,7 @@ describe "Admin Flags Page", type: :system do
|
||||
|
||||
# update
|
||||
admin_flags_page.visit.click_edit_flag("custom_vulgar")
|
||||
expect(page).not_to have_css(".admin-page-header")
|
||||
expect(admin_header).to be_hidden
|
||||
admin_flag_form_page.fill_in_name("Tasteless").click_save
|
||||
|
||||
expect(admin_flags_page).to have_flags(
|
||||
|
||||
@@ -6,9 +6,11 @@ describe "Admin User Fields", type: :system do
|
||||
before { sign_in(current_user) }
|
||||
|
||||
let(:user_fields_page) { PageObjects::Pages::AdminUserFields.new }
|
||||
let(:admin_header) { PageObjects::Components::AdminHeader.new }
|
||||
|
||||
it "correctly saves user fields" do
|
||||
user_fields_page.visit
|
||||
expect(admin_header).to be_visible
|
||||
user_fields_page.add_field(name: "Occupation", description: "What you do for work")
|
||||
|
||||
expect(user_fields_page).to have_user_field("Occupation")
|
||||
@@ -30,6 +32,8 @@ describe "Admin User Fields", type: :system do
|
||||
user_fields_page.visit
|
||||
user_fields_page.click_add_field
|
||||
|
||||
expect(admin_header).to be_hidden
|
||||
|
||||
form = page.find(".user-field")
|
||||
editable_label = I18n.t("admin_js.admin.user_fields.editable.title")
|
||||
|
||||
@@ -69,6 +73,8 @@ describe "Admin User Fields", type: :system do
|
||||
|
||||
form.find(".user-field-name").fill_in(with: "Favourite Transformer")
|
||||
|
||||
expect(admin_header).to be_hidden
|
||||
|
||||
form.find(".btn-primary").click
|
||||
|
||||
expect(page).to have_no_text(I18n.t("admin_js.admin.user_fields.requirement.confirmation"))
|
||||
|
||||
@@ -6,6 +6,14 @@ module PageObjects
|
||||
def has_tabs?(names)
|
||||
expect(page.all(".admin-nav-submenu__tabs a").map(&:text)).to eq(names)
|
||||
end
|
||||
|
||||
def visible?
|
||||
has_css?(".admin-page-header")
|
||||
end
|
||||
|
||||
def hidden?
|
||||
has_no_css?(".admin-page-header")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user