From 5900e3fad6c6db99401642ca1adab10aeab1b85f Mon Sep 17 00:00:00 2001 From: Santiago Simoncelli Date: Wed, 27 Nov 2024 14:58:59 -0300 Subject: [PATCH] [MER-3981] Adds test --- .../live/workspaces/course_author_test.exs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/oli_web/live/workspaces/course_author_test.exs b/test/oli_web/live/workspaces/course_author_test.exs index 9e7e35010fb..58957d298c3 100644 --- a/test/oli_web/live/workspaces/course_author_test.exs +++ b/test/oli_web/live/workspaces/course_author_test.exs @@ -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() @@ -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