germsvel / phoenix_test

PhoenixTest provides a unified way of writing feature tests -- regardless of whether you're testing LiveView pages or static (non-LiveView) pages.
https://hex.pm/packages/phoenix_test
MIT License
170 stars 22 forks source link

Fix assert_has/refute_has title matching exactly #65

Closed germsvel closed 6 months ago

germsvel commented 6 months ago

Resolves https://github.com/germsvel/phoenix_test/issues/64

What changed?

Our assert_has/3 and refute_has/3 helpers with "title" behave differently from the rest of our assertion helpers.

By default our other assertion helpers perform a match (=~) operation. Our "title" assertion performs an equality (==) operation.

In addition to being different from the rest, it's annoying because we typically render the title with a <.live_title> tag which has newlines and spaces.

We fix that in this commit and allow people to pass exact: true to match exactly.