From 74babd60088abc413718b721ed9aa57e9c43dee1 Mon Sep 17 00:00:00 2001 From: Kamaro Date: Tue, 11 Jun 2024 16:56:28 +0300 Subject: [PATCH] Added avatar and alert tests --- test/salad_ui/avatar_test.exs | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/salad_ui/avatar_test.exs diff --git a/test/salad_ui/avatar_test.exs b/test/salad_ui/avatar_test.exs new file mode 100644 index 0000000..0a67339 --- /dev/null +++ b/test/salad_ui/avatar_test.exs @@ -0,0 +1,46 @@ +defmodule SaladUI.AvatarTest do + use ComponentCase + import SaladUI.Avatar + + describe "Test Avatar" do + test "It renders avatar image correctly" do + assigns = %{} + + html = rendered_to_string( + ~H""" + <.avatar_image src="https://github.com/shadcn.png" /> + """ + ) + + assert html =~ "CN + """ + ) + + assert html =~ "" + assert html =~ "CN" + end + + test "It renders avatar correctly" do + assigns = %{} + html = rendered_to_string( + ~H""" + <.avatar> + <.avatar_image src="https://github.com/shadcn.png" /> + <.avatar_fallback class="bg-primary text-white">CN + + """ + ) + + assert html =~ "" + assert html =~ "CN" + end + end +end