By default assert_has does substring matching unless exact: true is specified. But assert_has(session, "title", "some page title") always does exact string matching. This is surprising given how that function works with all other elements.
It's especially annoying when using a .live_title component with a prefix or suffix, because LiveView seems to include a bunch of whitespace (newlines and extra spaces) depending on the formatting in root.html.heex around where the @page_title assign is used.
By default
assert_has
does substring matching unlessexact: true
is specified. Butassert_has(session, "title", "some page title")
always does exact string matching. This is surprising given how that function works with all other elements.It's especially annoying when using a
.live_title
component with a prefix or suffix, because LiveView seems to include a bunch of whitespace (newlines and extra spaces) depending on the formatting inroot.html.heex
around where the@page_title
assign is used.For example, I have this in my
root.html.heex
:When I do
assert_has(session, "title", "Title")
, I get the following error: