FEATURE: expand the admin sidebar when filtering (#27312)

Even when the admin sidebar sections are collapsed, they should expand while filtering. When the filter is removed, sections should go back to the previous state.

In addition, trim whitespace from the filter section.
This commit is contained in:
Krzysztof Kotlarek
2024-06-04 12:23:21 +10:00
committed by GitHub
parent 472c02bda8
commit eebf332025
5 changed files with 44 additions and 3 deletions

View File

@@ -105,6 +105,29 @@ describe "Admin Revamp | Sidebar Navigation", type: :system do
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(3)
expect(links.map(&:text)).to eq(["Appearance", "Preview Summary", "Server Setup"])
filter.filter(" preview ")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(1)
expect(links.map(&:text)).to eq(["Preview Summary"])
expect(page).to have_no_css(".sidebar-no-results")
end
it "temporarily expands section when filter" do
visit("/admin")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(2)
expect(links.map(&:text)).to eq(["Dashboard", "All Site Settings"])
filter.filter("ie")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(2)
expect(links.map(&:text)).to eq(["User Fields", "Preview Summary"])
filter.filter("")
links = page.all(".sidebar-section-link-content-text")
expect(links.count).to eq(2)
expect(links.map(&:text)).to eq(["Dashboard", "All Site Settings"])
end
it "allows further filtering of site settings or users if links do not show results" do