mirror of
https://github.com/woutdp/live_svelte
synced 2026-05-24 09:28:21 +00:00
* add an exmaple with a static svelte component in a live view parent with list * adjusted the styling of example * chore: added more e2e tests * chore: preserve client state * chore: added tests for simple counter * chore: added live lights e2e tests * chore: added sigil e2e tests * chore: added plus/minus tests * chore: added live plus/minus tests * chore: added hybrid plus/minus tests * chore: added static color demo tests * fix: handle correctly v sigil props * chore: added tests to log list example * chore: added tests to breaking news example * chore: added chat tests * chore: added tests for live json * chore: added tests for simple slots * chore: added tests for dynamic slots. added missing test ids * chore: add tests to client loading * chore: addes tests to otp ecto example * chore: prepare for 0.17.4 release
39 lines
1.3 KiB
Elixir
39 lines
1.3 KiB
Elixir
defmodule ExampleWeb.LodashTest do
|
|
use ExampleWeb.FeatureCase, async: false
|
|
|
|
@moduledoc """
|
|
E2E tests for the /lodash page (PageController + Lodash Svelte component).
|
|
"""
|
|
@moduletag :e2e
|
|
|
|
test "lodash page loads and shows Lodash Demo content", %{session: session} do
|
|
session = visit(session, "/lodash")
|
|
|
|
session |> find(Query.css("h1", text: "Lodash Demo"))
|
|
session |> find(Query.css("h2", text: "Sorted with lodash"))
|
|
end
|
|
|
|
test "lodash page shows unordered array from LiveView props", %{session: session} do
|
|
session = visit(session, "/lodash")
|
|
|
|
# Props are %{unordered: [10, 50, 25, 1, 3, 100, 40, 30]}
|
|
el = session |> find(Query.css("[data-testid='lodash-unordered']"))
|
|
assert Wallaby.Element.text(el) =~ "10"
|
|
assert Wallaby.Element.text(el) =~ "50"
|
|
assert Wallaby.Element.text(el) =~ "1"
|
|
assert Wallaby.Element.text(el) =~ "100"
|
|
end
|
|
|
|
test "lodash page shows sorted array from lodash sortBy", %{session: session} do
|
|
session = visit(session, "/lodash")
|
|
|
|
# Sorted: 1, 3, 10, 25, 30, 40, 50, 100
|
|
el = session |> find(Query.css("[data-testid='lodash-ordered']"))
|
|
text = Wallaby.Element.text(el)
|
|
assert text =~ "1"
|
|
assert text =~ "100"
|
|
assert text =~ "50"
|
|
# Order matters: 1 should appear before 10, 10 before 25, etc.
|
|
assert text =~ "1, 3, 10, 25, 30, 40, 50, 100"
|
|
end
|
|
end
|