Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.5.0 (WIP)

* [components] ErrorTag: Renamed prop `phx_trigger_action` to `trigger_action`

## v0.4.0 (2021-05-01)

* Call render when defined in slotable components (#283)
Expand Down
6 changes: 3 additions & 3 deletions lib/surface/components/form/error_tag.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defmodule Surface.Components.Form.ErrorTag do
```

```surface
<ErrorTag phx_feedback_for="confirm_password_for_reset" />
<ErrorTag feedback_for="confirm_password_for_reset" />
```

```surface
Expand Down Expand Up @@ -97,7 +97,7 @@ defmodule Surface.Components.Form.ErrorTag do
with an input of the same name. LiveView will exhibit buggy behavior
without assigning separate id's to each.)
"""
prop phx_feedback_for, :string
prop feedback_for, :string

def render(assigns) do
translate_error = assigns.translator || translator_from_config() || (&translate_error/1)
Expand All @@ -108,7 +108,7 @@ defmodule Surface.Components.Form.ErrorTag do
<span
:for={error <- Keyword.get_values(form.errors, field)}
class={class}
phx-feedback-for={@phx_feedback_for || input_id(form, field)}
phx-feedback-for={@feedback_for || input_id(form, field)}
>{translate_error.(error)}</span>
</InputContext>
"""
Expand Down
4 changes: 2 additions & 2 deletions test/components/form/error_tag_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ defmodule Surface.Components.Form.ErrorTagTest do
refute html =~ "another test error"
end

test "prop phx_feedback_for", %{changeset: changeset} do
test "prop feedback_for", %{changeset: changeset} do
assigns = %{changeset: changeset}

html =
render_surface do
~H"""
<Form for={@changeset} opts={as: :user}>
<Field name={:name}>
<ErrorTag phx_feedback_for="test-id" />
<ErrorTag feedback_for="test-id" />
</Field>
</Form>
"""
Expand Down