mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-20 07:12:49 +12:00
chore: fix tests
This commit is contained in:
parent
d80a87c062
commit
09f673751b
3 changed files with 10 additions and 6 deletions
|
@ -352,6 +352,7 @@ defmodule AshPhoenix.Form.Auto do
|
||||||
Keyword.update!(opts, :forms, fn forms ->
|
Keyword.update!(opts, :forms, fn forms ->
|
||||||
Keyword.put(forms, :_join,
|
Keyword.put(forms, :_join,
|
||||||
resource: relationship.through,
|
resource: relationship.through,
|
||||||
|
type: :single,
|
||||||
managed_relationship: {relationship.source, relationship.name},
|
managed_relationship: {relationship.source, relationship.name},
|
||||||
create_action: action.name
|
create_action: action.name
|
||||||
)
|
)
|
||||||
|
|
|
@ -1865,11 +1865,11 @@ defmodule AshPhoenix.Form do
|
||||||
touched_forms = opts[:touched_forms] || MapSet.new()
|
touched_forms = opts[:touched_forms] || MapSet.new()
|
||||||
|
|
||||||
touched_forms =
|
touched_forms =
|
||||||
Enum.reduce(forms, touched_forms, fn {key, form_or_forms}, touched_forms ->
|
Enum.reduce(forms, touched_forms, fn {key, _form_or_forms}, touched_forms ->
|
||||||
if form_or_forms in [nil, []] do
|
if Map.has_key?(params, to_string(key)) do
|
||||||
touched_forms
|
|
||||||
else
|
|
||||||
MapSet.put(touched_forms, to_string(key))
|
MapSet.put(touched_forms, to_string(key))
|
||||||
|
else
|
||||||
|
touched_forms
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -2945,6 +2945,9 @@ defmodule AshPhoenix.Form do
|
||||||
as: name <> "[#{key}]",
|
as: name <> "[#{key}]",
|
||||||
id: id <> "_#{key}"
|
id: id <> "_#{key}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
other ->
|
||||||
|
raise "unexpected form type for form with no data #{other} with params: #{inspect(form_params)}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -922,7 +922,7 @@ defmodule AshPhoenix.FormTest do
|
||||||
|
|
||||||
form =
|
form =
|
||||||
comment
|
comment
|
||||||
|> Form.for_update(:create,
|
|> Form.for_update(:update,
|
||||||
forms: [
|
forms: [
|
||||||
post: [
|
post: [
|
||||||
data: comment.post,
|
data: comment.post,
|
||||||
|
@ -1006,7 +1006,7 @@ defmodule AshPhoenix.FormTest do
|
||||||
|
|
||||||
form =
|
form =
|
||||||
comment
|
comment
|
||||||
|> Form.for_update(:create,
|
|> Form.for_update(:update,
|
||||||
forms: [
|
forms: [
|
||||||
posts: [
|
posts: [
|
||||||
data: comment.post,
|
data: comment.post,
|
||||||
|
|
Loading…
Reference in a new issue