adds failing tests against the markdown behavior

This commit is contained in:
Tessa Kelly 2022-11-16 13:53:50 -07:00
parent a2ca489d67
commit 89a34ed25b

View File

@ -20,6 +20,7 @@ spec : Test
spec =
describe "Nri.Ui.Highlighter.V1"
[ describe "keyboard behavior" keyboardTests
, describe "markdown behavior" markdownTests
]
@ -238,6 +239,50 @@ keyboardTests =
]
markdownTests : List Test
markdownTests =
let
start view =
ProgramTest.createSandbox
{ init =
Highlighter.init
{ id = "markdown-tests-highlighter-container"
, highlightables = highlightables
, marker = marker Nothing
}
, update = \_ m -> m
, view = view >> toUnstyled
}
|> ProgramTest.start ()
highlightables =
Highlightable.initFragments Nothing
"*Pothos* indirect light"
testRendersRawContent testName view =
test (testName ++ " does not interpret content as markdown")
(\() -> expectViewHas [ Selector.text "*Pothos*" ] (start view))
testRendersMarkdownContent testName view =
test (testName ++ " does interpret content as markdown")
(\() ->
start view
|> ensureViewHasNot [ Selector.text "*Pothos*" ]
|> expectViewHas
[ Selector.tag "em"
, Selector.containing [ Selector.text "Pothos" ]
]
)
in
[ testRendersRawContent "view" Highlighter.view
, testRendersMarkdownContent "viewMarkdown" Highlighter.viewMarkdown
, testRendersRawContent "static" Highlighter.static
, testRendersMarkdownContent "staticMarkdown" Highlighter.staticMarkdown
, testRendersRawContent "staticWithTags" Highlighter.staticWithTags
, testRendersMarkdownContent "staticMarkdownWithTags" Highlighter.staticMarkdownWithTags
]
hasStartHighlightBeforeContent : String -> String -> Query.Single msg -> Expectation
hasStartHighlightBeforeContent startHighlightMarker relevantHighlightableText view =
let