Skip to content

Commit

Permalink
[MER-3981] Adds test
Browse files Browse the repository at this point in the history
  • Loading branch information
simonchoxx committed Nov 27, 2024
1 parent 36a2844 commit 5900e3f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/oli_web/live/workspaces/course_author_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,19 @@ defmodule OliWeb.Workspaces.CourseAuthorTest do
assert project_row =~ "Active"
end

test "the modal text displays clearly using the appropriate dark mode class", %{
conn: conn
} do
{:ok, view, _html} = live(conn, ~p"/workspaces/course_author")

view |> element("button", "New Project") |> render_click()

html = render(view)
parsed_html = Floki.parse_document!(html)

assert has_class?(parsed_html, "h5", "dark:text-[#eeebf5]")
end

test "applies show-all filter", %{conn: conn, admin: admin} do
admin_project = create_project_with_owner(admin)
project = insert(:author) |> create_project_with_owner()
Expand Down Expand Up @@ -669,4 +682,13 @@ defmodule OliWeb.Workspaces.CourseAuthorTest do
insert(:author_project, project_id: project.id, author_id: owner.id)
project
end

defp has_class?(parsed_html, tag, class_name) do
Floki.find(parsed_html, tag)
|> Enum.any?(fn {_tag, attrs, _content} ->
Enum.any?(attrs, fn {key, value} ->
key == "class" and String.contains?(value, class_name)
end)
end)
end
end

0 comments on commit 5900e3f

Please sign in to comment.