-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a098a83
commit bace1b1
Showing
3 changed files
with
33 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -794,32 +794,34 @@ defmodule AshPhoenix.FormTest do | |
|> Form.add_form(:embedded_argument, params: %{}) | ||
|> Form.validate(%{"embedded_argument" => %{"value" => "[email protected]"}}) | ||
|> form_for("action") | ||
[nested_form] = inputs_for(form, :embedded_argument) | ||
|
||
[nested_form] = inputs_for(form, :embedded_argument) | ||
|
||
# This is the top level error with a path to the nest form. | ||
assert [ | ||
%Ash.Error.Changes.InvalidArgument{ | ||
field: :value, | ||
message: "must match email", | ||
value: "[email protected]", | ||
path: [:embedded_argument], | ||
class: :invalid | ||
} | ||
] = form.source.source.errors | ||
assert form.errors == [] | ||
|
||
# This is the error on the nested form. | ||
assert [ | ||
%Ash.Error.Changes.InvalidArgument{ | ||
field: :value, | ||
message: "must match email", | ||
value: "[email protected]", | ||
path: [], | ||
class: :invalid | ||
} | ||
] = nested_form.source.source.errors | ||
assert nested_form.errors == [{:value, {"must match email", []}}] | ||
# This is the top level error with a path to the nest form. | ||
assert [ | ||
%Ash.Error.Changes.InvalidArgument{ | ||
field: :value, | ||
message: "must match email", | ||
value: "[email protected]", | ||
path: [:embedded_argument], | ||
class: :invalid | ||
} | ||
] = form.source.source.errors | ||
|
||
assert form.errors == [] | ||
|
||
# This is the error on the nested form. | ||
assert [ | ||
%Ash.Error.Changes.InvalidArgument{ | ||
field: :value, | ||
message: "must match email", | ||
value: "[email protected]", | ||
path: [], | ||
class: :invalid | ||
} | ||
] = nested_form.source.source.errors | ||
|
||
assert nested_form.errors == [{:value, {"must match email", []}}] | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters