Fix credo quote-sigil warning in microprints_live_test.exs
Replace double-quoted string with escaped quotes in element selector with a ~s sigil to satisfy Credo's 'More than 3 quotes found inside string literal' readability check. Includes formatting changes from mix format (ran via make check).
This commit is contained in:
@@ -70,7 +70,9 @@ defmodule FirehoseWeb.MicroprintsLiveTest do
|
||||
end
|
||||
|
||||
describe "expanded_path and highlighted_path coupling" do
|
||||
test "expanding file A and highlighting a line in file B should collapse file A", %{conn: conn} do
|
||||
test "expanding file A and highlighting a line in file B should collapse file A", %{
|
||||
conn: conn
|
||||
} do
|
||||
files = MicroprintsLive.scan_source_files()
|
||||
assert length(files) >= 2, "Need at least 2 files to test coupling"
|
||||
|
||||
@@ -90,16 +92,19 @@ defmodule FirehoseWeb.MicroprintsLiveTest do
|
||||
|
||||
# Highlight a line in file B (rect elements inside SVG)
|
||||
view
|
||||
|> element("svg rect[phx-value-line=\"1\"][phx-value-path=\"#{file_b}\"]")
|
||||
|> element(~s(svg rect[phx-value-line="1"][phx-value-path="#{file_b}"]))
|
||||
|> render_click()
|
||||
|
||||
# file A should be collapsed when highlighting a different file
|
||||
html = render(view)
|
||||
|
||||
refute html =~ "Collapse",
|
||||
"file A should be collapsed after highlighting a different file, but the Collapse button is still visible (expanded_path is uncoupled from highlighted_path)"
|
||||
end
|
||||
|
||||
test "switching expand from file A to file B shows each file's own source content", %{conn: conn} do
|
||||
test "switching expand from file A to file B shows each file's own source content", %{
|
||||
conn: conn
|
||||
} do
|
||||
files = MicroprintsLive.scan_source_files()
|
||||
assert length(files) >= 2, "Need at least 2 files to test source switching"
|
||||
|
||||
@@ -148,8 +153,10 @@ defmodule FirehoseWeb.MicroprintsLiveTest do
|
||||
{:ok, view, _html} = live(conn, ~p"/microprints?expanded=#{file_a}")
|
||||
|
||||
html = render(view)
|
||||
|
||||
assert html =~ "Collapse",
|
||||
"Expanded file should show Collapse button when restored from URL param"
|
||||
|
||||
assert html =~ ~s(phx-value-path="#{file_a}")
|
||||
end
|
||||
|
||||
@@ -157,6 +164,7 @@ defmodule FirehoseWeb.MicroprintsLiveTest do
|
||||
{:ok, view, _html} = live(conn, ~p"/microprints?expanded=nonexistent.ex")
|
||||
|
||||
html = render(view)
|
||||
|
||||
refute html =~ "Collapse",
|
||||
"Nonexistent expanded path should not show Collapse"
|
||||
end
|
||||
@@ -173,6 +181,7 @@ defmodule FirehoseWeb.MicroprintsLiveTest do
|
||||
|
||||
# URL should contain expanded param after clicking Expand
|
||||
html = render(view)
|
||||
|
||||
assert html =~ "Collapse",
|
||||
"File should remain expanded after push_patch updates URL"
|
||||
end
|
||||
|
||||
@@ -25,8 +25,10 @@ defmodule FirehoseWeb.SourceViewerTest do
|
||||
|
||||
assert has_element?(view, "#line-1"),
|
||||
"Line 1 should exist in the source viewer"
|
||||
|
||||
assert has_element?(view, "#line-2"),
|
||||
"Line 2 should exist in the source viewer"
|
||||
|
||||
assert has_element?(view, "#line-3"),
|
||||
"Line 3 should exist in the source viewer"
|
||||
end
|
||||
@@ -54,10 +56,12 @@ defmodule FirehoseWeb.SourceViewerTest do
|
||||
expand_file(view, file)
|
||||
|
||||
click_microprint_rect(view, file, 1)
|
||||
|
||||
assert has_element?(view, "#line-1.sv-line-highlighted"),
|
||||
"Line 1 should be highlighted after first click"
|
||||
|
||||
click_microprint_rect(view, file, 1)
|
||||
|
||||
refute has_element?(view, "#line-1.sv-line-highlighted"),
|
||||
"Line 1 should no longer be highlighted after second click"
|
||||
end
|
||||
@@ -66,7 +70,8 @@ defmodule FirehoseWeb.SourceViewerTest do
|
||||
files = MicroprintsLive.scan_source_files()
|
||||
file = List.first(files)
|
||||
|
||||
{:ok, view, _html} = live(conn, ~p"/microprints?expanded=#{file}&line=1&highlighted=#{file}")
|
||||
{:ok, view, _html} =
|
||||
live(conn, ~p"/microprints?expanded=#{file}&line=1&highlighted=#{file}")
|
||||
|
||||
assert has_element?(view, "#line-1.sv-line-highlighted"),
|
||||
"Line 1 should be highlighted when restored from URL params"
|
||||
|
||||
Reference in New Issue
Block a user