mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-19 23:02:48 +12:00
test: form value fill for union (#205)
This commit is contained in:
parent
f347f90f79
commit
e333471888
2 changed files with 20 additions and 1 deletions
|
@ -333,6 +333,25 @@ defmodule AshPhoenix.AutoFormTest do
|
|||
Enum.at(result.items, 0).subject
|
||||
end)
|
||||
end
|
||||
|
||||
test "union filled value is shown in input" do
|
||||
form =
|
||||
%SimplePost{union: %Ash.Union{value: :update, type: :predefined}}
|
||||
|> AshPhoenix.Form.for_update(:update,
|
||||
domain: Domain,
|
||||
forms: [
|
||||
auto?: true
|
||||
],
|
||||
params: %{
|
||||
"text" => "foobar"
|
||||
}
|
||||
)
|
||||
|
||||
# |> Phoenix.HTML.FormData.to_form([])
|
||||
|
||||
# IO.inspect(Phoenix.Component.inputs_for(%{field: form[:union], __changed__: %{}}))
|
||||
# assert "update" == AshPhoenix.Form.value(form[:union], :value)
|
||||
end
|
||||
end
|
||||
|
||||
describe "list unions" do
|
||||
|
|
|
@ -30,6 +30,6 @@ defmodule AshPhoenix.Test.SimplePost do
|
|||
|
||||
actions do
|
||||
default_accept(:*)
|
||||
defaults([:create])
|
||||
defaults([:create, :update])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue