From 9f8580919565b0eaad161fbfa13f81b7909f1acb Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 25 Dec 2023 19:35:00 +0100 Subject: [PATCH] Mod FormtemplateResource --- app/Form/Resources/FormtemplateResource.php | 9 +++++++++ tests/Feature/Form/FormtemplateIndexActionTest.php | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/app/Form/Resources/FormtemplateResource.php b/app/Form/Resources/FormtemplateResource.php index 2252fc6c..ef81161d 100644 --- a/app/Form/Resources/FormtemplateResource.php +++ b/app/Form/Resources/FormtemplateResource.php @@ -31,6 +31,13 @@ class FormtemplateResource extends JsonResource [ 'id' => 'TextField', 'name' => 'Text', + 'default' => [ + 'name' => '', + 'type' => 'TextField', + 'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 12], + 'default' => '', + 'required' => false, + ] ] ], 'links' => [ @@ -43,6 +50,8 @@ class FormtemplateResource extends JsonResource ] ], 'section_default' => [ + 'name' => '', + 'intro' => '', 'fields' => [], ] ]; diff --git a/tests/Feature/Form/FormtemplateIndexActionTest.php b/tests/Feature/Form/FormtemplateIndexActionTest.php index 01be7d10..57859c6a 100644 --- a/tests/Feature/Form/FormtemplateIndexActionTest.php +++ b/tests/Feature/Form/FormtemplateIndexActionTest.php @@ -18,6 +18,13 @@ class FormtemplateIndexActionTest extends TestCase ->assertInertiaPath('data.meta.fields.0', [ 'id' => 'TextField', 'name' => 'Text', + 'default' => [ + 'name' => '', + 'type' => 'TextField', + 'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 12], + 'default' => '', + 'required' => false, + ] ]) ->assertInertiaPath('data.meta.default', [ 'name' => '', @@ -27,6 +34,8 @@ class FormtemplateIndexActionTest extends TestCase ]) ->assertInertiaPath('data.meta.links.store', route('formtemplate.store')) ->assertInertiaPath('data.meta.section_default', [ + 'name' => '', + 'intro' => '', 'fields' => [], ]); }