feat: improve sidebar handling
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
16ca4efc03
commit
aba8737c38
6 changed files with 93 additions and 15 deletions
|
|
@ -712,19 +712,19 @@ defmodule MvWeb.Layouts.SidebarTest do
|
|||
html = render_sidebar(authenticated_assigns(false))
|
||||
|
||||
# Toggle button has onclick handler
|
||||
assert html =~ ~s(onclick="toggleSidebar()")
|
||||
assert html =~ ~r/onclick="toggleSidebar\(\)"/
|
||||
end
|
||||
|
||||
test "no duplicate IDs in layout" do
|
||||
html = render_sidebar(authenticated_assigns())
|
||||
|
||||
# Check that main-sidebar ID appears only once
|
||||
id_count = html |> String.split(~s(id="main-sidebar")) |> length() |> Kernel.-(1)
|
||||
id_count = html |> String.split(~r/id="main-sidebar"/) |> length() |> Kernel.-(1)
|
||||
assert id_count == 1, "main-sidebar ID should appear exactly once"
|
||||
|
||||
# Check that sidebar-toggle ID appears only once (if present)
|
||||
if html =~ ~s(id="sidebar-toggle") do
|
||||
toggle_count = html |> String.split(~s(id="sidebar-toggle")) |> length() |> Kernel.-(1)
|
||||
if html =~ ~r/id="sidebar-toggle"/ do
|
||||
toggle_count = html |> String.split(~r/id="sidebar-toggle"/) |> length() |> Kernel.-(1)
|
||||
assert toggle_count == 1, "sidebar-toggle ID should appear exactly once"
|
||||
end
|
||||
end
|
||||
|
|
@ -844,7 +844,7 @@ defmodule MvWeb.Layouts.SidebarTest do
|
|||
assert has_class?(html, "dropdown-content")
|
||||
|
||||
# Should have both Profile and Logout links
|
||||
assert html =~ ~s(href="/sign-out")
|
||||
assert html =~ "sign-out"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue