fix: update tests to match Tailwind v4 utility classes after DaisyUI removal
This commit is contained in:
parent
51c23a9659
commit
e77a848f2f
3 changed files with 46 additions and 27 deletions
|
|
@ -123,12 +123,12 @@ defmodule ToweropsWeb.LayoutsTest do
|
|||
|
||||
# Mobile menu contains all nav sections
|
||||
# (Mobile menu has same links as sidebar)
|
||||
assert html =~ "hero-home"
|
||||
assert html =~ "hero-server"
|
||||
assert html =~ "hero-bell-alert"
|
||||
assert html =~ "hero-wrench-screwdriver"
|
||||
assert html =~ "hero-light-bulb"
|
||||
assert html =~ "hero-clock"
|
||||
assert html =~ "Dashboard"
|
||||
assert html =~ "Devices"
|
||||
assert html =~ "Alerts"
|
||||
assert html =~ "Maintenance"
|
||||
assert html =~ "Insights"
|
||||
assert html =~ "Activity"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ defmodule ToweropsWeb.TraceLive.IndexHelpersTest do
|
|||
describe "type_badge_class/1 + type_badge_label/1" do
|
||||
test "known types" do
|
||||
for {type, class, label} <- [
|
||||
{:account, "badge-primary", "Account"},
|
||||
{:inventory_item, "badge-secondary", "Inventory"},
|
||||
{:site, "badge-warning", "Site"},
|
||||
{:device, "badge-accent", "Device"},
|
||||
{:access_point, "badge-info", "AP"}
|
||||
{:account, "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400", "Account"},
|
||||
{:inventory_item, "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400", "Inventory"},
|
||||
{:site, "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400", "Site"},
|
||||
{:device, "bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-400", "Device"},
|
||||
{:access_point, "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400", "AP"}
|
||||
] do
|
||||
assert class == Index.type_badge_class(type)
|
||||
assert label == Index.type_badge_label(type)
|
||||
|
|
@ -18,21 +18,24 @@ defmodule ToweropsWeb.TraceLive.IndexHelpersTest do
|
|||
end
|
||||
|
||||
test "unknown falls through to ghost/Unknown" do
|
||||
assert "badge-ghost" == Index.type_badge_class(:other)
|
||||
assert "text-gray-700 dark:text-gray-300" == Index.type_badge_class(:other)
|
||||
assert "Unknown" == Index.type_badge_label(:other)
|
||||
end
|
||||
end
|
||||
|
||||
describe "status_badge_class/1" do
|
||||
test "active/suspended/cancelled" do
|
||||
assert "badge-success" == Index.status_badge_class("active")
|
||||
assert "badge-warning" == Index.status_badge_class("suspended")
|
||||
assert "badge-error" == Index.status_badge_class("cancelled")
|
||||
assert "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" == Index.status_badge_class("active")
|
||||
|
||||
assert "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400" ==
|
||||
Index.status_badge_class("suspended")
|
||||
|
||||
assert "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" == Index.status_badge_class("cancelled")
|
||||
end
|
||||
|
||||
test "unknown is ghost" do
|
||||
assert "badge-ghost" == Index.status_badge_class(nil)
|
||||
assert "badge-ghost" == Index.status_badge_class("other")
|
||||
assert "text-gray-700 dark:text-gray-300" == Index.status_badge_class(nil)
|
||||
assert "text-gray-700 dark:text-gray-300" == Index.status_badge_class("other")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -48,12 +48,22 @@ defmodule ToweropsWeb.TraceLive.IndexTest do
|
|||
|
||||
describe "format helpers" do
|
||||
test "type_badge_class covers known and unknown types" do
|
||||
assert Index.type_badge_class(:account) == "badge-primary"
|
||||
assert Index.type_badge_class(:inventory_item) == "badge-secondary"
|
||||
assert Index.type_badge_class(:site) == "badge-warning"
|
||||
assert Index.type_badge_class(:device) == "badge-accent"
|
||||
assert Index.type_badge_class(:access_point) == "badge-info"
|
||||
assert Index.type_badge_class(:totally_unknown) == "badge-ghost"
|
||||
assert Index.type_badge_class(:account) ==
|
||||
"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"
|
||||
|
||||
assert Index.type_badge_class(:inventory_item) ==
|
||||
"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400"
|
||||
|
||||
assert Index.type_badge_class(:site) ==
|
||||
"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"
|
||||
|
||||
assert Index.type_badge_class(:device) ==
|
||||
"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-400"
|
||||
|
||||
assert Index.type_badge_class(:access_point) ==
|
||||
"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
|
||||
|
||||
assert Index.type_badge_class(:totally_unknown) == "text-gray-700 dark:text-gray-300"
|
||||
end
|
||||
|
||||
test "type_badge_label covers known and unknown" do
|
||||
|
|
@ -63,10 +73,16 @@ defmodule ToweropsWeb.TraceLive.IndexTest do
|
|||
end
|
||||
|
||||
test "status_badge_class covers all branches" do
|
||||
assert Index.status_badge_class("active") == "badge-success"
|
||||
assert Index.status_badge_class("suspended") == "badge-warning"
|
||||
assert Index.status_badge_class("cancelled") == "badge-error"
|
||||
assert Index.status_badge_class("frob") == "badge-ghost"
|
||||
assert Index.status_badge_class("active") ==
|
||||
"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"
|
||||
|
||||
assert Index.status_badge_class("suspended") ==
|
||||
"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"
|
||||
|
||||
assert Index.status_badge_class("cancelled") ==
|
||||
"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"
|
||||
|
||||
assert Index.status_badge_class("frob") == "text-gray-700 dark:text-gray-300"
|
||||
end
|
||||
|
||||
test "device_status_color covers all branches" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue