Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type wrapper #208

Merged
merged 1 commit into from
Jun 10, 2024
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
12 changes: 12 additions & 0 deletions test/form_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
"Unhandled error in form submission for AshPhoenix.Test.Comment.create_with_unknown_error"
end

test "empty atom field" do

Check failure on line 61 in test/form_test.exs

View workflow job for this annotation

GitHub Actions / ash-ci / mix test

test validate_opts empty atom field (AshPhoenix.FormTest)
form =

Check warning on line 62 in test/form_test.exs

View workflow job for this annotation

GitHub Actions / ash-ci / mix test

variable "form" is unused (if the variable is not meant to be used, prefix it with an underscore)
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
Expand Down
3 changes: 3 additions & 0 deletions test/support/resources/atom_type.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule AshPhoenix.Test.Action do
use Ash.Type.NewType, subtype_of: :atom
end
2 changes: 2 additions & 0 deletions test/support/resources/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading