Skip to content

Commit 4e9d49c

Browse files
committed
add entry about test warnings
1 parent 43af37c commit 4e9d49c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,25 @@ Here's an example that shows the debug annotations:
9595

9696
The comments can be disabled with `debug_heex_annotations` and the `data-phx-loc` attributes with `debug_attributes`.
9797

98+
## Granular configuration for test warnings
99+
100+
LiveView includes some built in checks that run on the DOM when testing. For example,
101+
tests will raise an exception if a duplicate ID is detected. We added a new check for forms
102+
with `phx-change` but missing `id` attribute, because without an `id` [form recovery](https://hexdocs.pm/phoenix_live_view/form-bindings.html#recovery-following-crashes-or-disconnects)
103+
does not work. Since the severity of that check is different compared to a duplicate ID,
104+
LiveView now allows you to configure what should happen for each check:
105+
106+
```elixir
107+
config :phoenix_live_view, :test_warnings,
108+
duplicate_id: :warn, # one of :warn, :raise, :ignore
109+
...
110+
```
111+
112+
By default, a form without an ID will now emit a warning. You can opt out of this check per form
113+
by setting `phx-ignore-missing-id` or disable it globally with the `:missing_form_id` warning option.
114+
115+
See the module documentation or `Phoenix.LiveViewTest` for more information.
116+
98117
## v1.2.0-rc.0 (Unreleased)
99118

100119
### Enhancements
@@ -108,6 +127,7 @@ The comments can be disabled with `debug_heex_annotations` and the `data-phx-loc
108127
* HEEx: Allow to opt out of debug annotations for a module ([#4119](https://github.com/phoenixframework/phoenix_live_view/pull/4119))
109128
* HEEx: warn when missing a space between attributes ([#3999](https://github.com/phoenixframework/phoenix_live_view/issues/3999))
110129
* HTMLFormatter: Add `TagFormatter` behaviour for formatting `<style>` and `<script>` tags ([#4140](https://github.com/phoenixframework/phoenix_live_view/pull/4140))
130+
* Add configuration option for `:test_warnings` and warn for forms without an ID by default ([#4128](https://github.com/phoenixframework/phoenix_live_view/pull/4128))
111131
* Performance optimizations in diffing hot path (Thank you [@preciz](https://github.com/preciz)!)
112132

113133
## v1.1

0 commit comments

Comments
 (0)