From 465d036620d9697e840e513eb20f250969186160 Mon Sep 17 00:00:00 2001 From: Darren Black Date: Sat, 21 May 2022 00:59:23 +1000 Subject: [PATCH] test: Failing test for `validate_opts` issue (#43) --- test/form_test.exs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/form_test.exs b/test/form_test.exs index 27698d5..c29ea8f 100644 --- a/test/form_test.exs +++ b/test/form_test.exs @@ -6,6 +6,28 @@ defmodule AshPhoenix.FormTest do alias AshPhoenix.Test.{Api, Comment, OtherApi, Post, PostWithDefault} alias Phoenix.HTML.FormData + describe "validate_opts" do + test "errors are not set on the parent and child form" do + form = + Post + |> Form.for_create(:create, + api: Api, + forms: [ + comments: [ + type: :list, + resource: Comment, + create_action: :create + ] + ] + ) + |> Form.add_form([:comments], validate_opts: [errors: false]) + |> form_for("action") + + assert form.errors == [] + assert Form.errors(form.source, for_path: [:comments, 0]) == [] + end + end + describe "form_for fields" do test "it should show simple field values" do form =