yak(behavior-tests-editorial-liveviews-microprints-editor-dashboard-llh3): behavior tests: editorial LiveViews (microprints, editor dashboard)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
defmodule FirehoseWeb.MicroprintsCase do
|
||||
@moduledoc """
|
||||
Helpers for driving the `/microprints` LiveView.
|
||||
|
||||
Both `FirehoseWeb.MicroprintsLiveTest` and `FirehoseWeb.SourceViewerTest` walk
|
||||
the same page through the same two controls (the per-card Expand/Collapse
|
||||
button and the microprint rects), so the mechanics live here instead of being
|
||||
re-implemented in each test module.
|
||||
|
||||
A plain module, imported by the tests, rather than a `use`-able case template:
|
||||
the LiveView tests own their own setup and only share these three actions.
|
||||
"""
|
||||
|
||||
import Phoenix.LiveViewTest
|
||||
|
||||
@doc """
|
||||
Clicks the Expand control of the card for `path` and returns the render.
|
||||
"""
|
||||
def expand_file(view, path) do
|
||||
view
|
||||
|> element(~s(button[phx-value-path="#{path}"]), "Expand")
|
||||
|> render_click()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Clicks the Collapse control of the card for `path` and returns the render.
|
||||
"""
|
||||
def collapse_file(view, path) do
|
||||
view
|
||||
|> element(~s(button[phx-value-path="#{path}"]), "Collapse")
|
||||
|> render_click()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Clicks a single line of a microprint, highlighting it in the source viewer.
|
||||
|
||||
The microprint renders several rect segments per line, so `element/3` cannot
|
||||
pick one; the `highlight_line` event is dispatched directly instead.
|
||||
"""
|
||||
def click_microprint_rect(view, path, line) do
|
||||
render_click(view, "highlight_line", %{"line" => Integer.to_string(line), "path" => path})
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user