Adds tests against clicking a static element

This commit is contained in:
Tessa Kelly 2023-04-05 11:21:29 -06:00
parent 83f92d0267
commit 4a928460c8

View File

@ -20,13 +20,34 @@ import Test.Html.Selector as Selector exposing (Selector)
spec : Test
spec =
describe "Nri.Ui.Highlighter"
[ describe "keyboard behavior" keyboardTests
[ describe "mouse behavior" mouseTests
, describe "keyboard behavior" keyboardTests
, describe "markdown behavior" markdownTests
, describe "joinAdjacentInteractiveHighlights" joinAdjacentInteractiveHighlightsTests
, describe "overlapping highlights" overlappingHighlightTests
]
mouseTests : List Test
mouseTests =
[ test "clicking on a static element does nothing" <|
\() ->
[ Highlightable.initStatic [] 0 "Pothos", Highlightable.initInteractive [] 1 "Philodendron" ]
|> program { markerName = Nothing, joinAdjacentInteractiveHighlights = False }
|> click "Pothos"
|> ensureViewHasNot [ Selector.tag "mark" ]
|> done
, test "starting a highlight from a static element works" <|
\() ->
[ Highlightable.initStatic [] 0 "Pothos", Highlightable.initInteractive [] 1 "Philodendron" ]
|> program { markerName = Nothing, joinAdjacentInteractiveHighlights = False }
|> mouseDown "Philodendron"
|> mouseUp "Pothos"
|> ensureMarked [ "Philodendron" ]
|> done
]
keyboardTests : List Test
keyboardTests =
[ test "has a focusable element when there is one" <|