diff --git a/test/form_test.exs b/test/form_test.exs index 80bb29b..a61468f 100644 --- a/test/form_test.exs +++ b/test/form_test.exs @@ -58,6 +58,18 @@ defmodule AshPhoenix.FormTest do "Unhandled error in form submission for AshPhoenix.Test.Comment.create_with_unknown_error" end + test "empty atom field" do + form = + Post + |> Form.for_create(:create, + domain: Domain, + params: %{} + ) + |> Form.submit!( + params: %{"inline_atom_field" => "", "custom_atom_field" => "", "text" => "text"} + ) + end + test "update_form marks touched by default" do form = Post diff --git a/test/support/resources/atom_type.ex b/test/support/resources/atom_type.ex new file mode 100644 index 0000000..4b7cd2f --- /dev/null +++ b/test/support/resources/atom_type.ex @@ -0,0 +1,3 @@ +defmodule AshPhoenix.Test.Action do + use Ash.Type.NewType, subtype_of: :atom +end diff --git a/test/support/resources/post.ex b/test/support/resources/post.ex index 26b0126..b2a7e81 100644 --- a/test/support/resources/post.ex +++ b/test/support/resources/post.ex @@ -16,6 +16,8 @@ defmodule AshPhoenix.Test.Post do attribute(:union_array, {:array, AshPhoenix.Test.UnionValue}, public?: true) attribute(:list_of_ints, {:array, :integer}, public?: true) attribute(:title, :string, public?: true) + attribute(:inline_atom_field, :atom, public?: true) + attribute(:custom_atom_field, AshPhoenix.Test.Action, public?: true) end actions do