56 lines
1.7 KiB
Elixir
56 lines
1.7 KiB
Elixir
defmodule MvWeb.MemberLive.IndexStickyPinnedTest do
|
|
@moduledoc """
|
|
§1.19 — When the table scrolls vertically and horizontally, the header stays
|
|
sticky and the identifier (Name) column stays pinned; overflowing cell content
|
|
truncates with ellipsis and exposes a hover/focus tooltip.
|
|
"""
|
|
use MvWeb.ConnCase, async: false
|
|
|
|
import Phoenix.LiveViewTest
|
|
|
|
alias Mv.Helpers.SystemActor
|
|
|
|
@moduletag :ui
|
|
|
|
setup %{conn: conn} do
|
|
{:ok, _} =
|
|
Mv.Membership.create_member(
|
|
%{
|
|
first_name: "Reginald",
|
|
last_name: "Worthington-Smythe",
|
|
email: "reginald@example.com",
|
|
street: "A Very Long Street Name That Overflows",
|
|
house_number: "123",
|
|
postal_code: "10115",
|
|
city: "Berlin"
|
|
},
|
|
actor: SystemActor.get_system_actor()
|
|
)
|
|
|
|
%{conn: conn_with_oidc_user(conn)}
|
|
end
|
|
|
|
test "header is sticky and the identifier column is pinned", %{conn: conn} do
|
|
{:ok, _view, html} = live(conn, ~p"/members")
|
|
|
|
# Sticky header (desktop).
|
|
assert html =~ "lg:sticky"
|
|
assert html =~ "lg:top-0"
|
|
|
|
# Checkbox column pinned at left-0, identifier (Name) column pinned beside it.
|
|
assert html =~ "left-0"
|
|
assert html =~ "left-12"
|
|
end
|
|
|
|
test "composite cells truncate and expose a tooltip via title", %{conn: conn} do
|
|
{:ok, view, _html} = live(conn, ~p"/members")
|
|
|
|
name_cell = view |> element("[data-testid='member-name']") |> render()
|
|
assert name_cell =~ "truncate"
|
|
assert name_cell =~ ~s(title="Reginald Worthington-Smythe")
|
|
|
|
address_cell = view |> element("[data-testid='member-address']") |> render()
|
|
assert address_cell =~ "truncate"
|
|
assert address_cell =~ ~s(title="A Very Long Street Name That Overflows 123")
|
|
end
|
|
end
|