diff --git a/resources/js/views/form/Index.vue b/resources/js/views/form/Index.vue index 682f5adf..79b7b3c0 100644 --- a/resources/js/views/form/Index.vue +++ b/resources/js/views/form/Index.vue @@ -228,6 +228,8 @@ const allFields = computed(() => { function setTemplate(template) { active.value = 0; single.value.config = template.config; + single.value.mail_top = template.mail_top; + single.value.mail_bottom = template.mail_bottom; } async function saveFileConditions(conditions) { diff --git a/tests/EndToEnd/Form/FormIndexActionTest.php b/tests/EndToEnd/Form/FormIndexActionTest.php index da0d0159..99be2836 100644 --- a/tests/EndToEnd/Form/FormIndexActionTest.php +++ b/tests/EndToEnd/Form/FormIndexActionTest.php @@ -19,7 +19,6 @@ class FormIndexActionTest extends FormTestCase { Carbon::setTestNow(Carbon::parse('2023-03-03')); $this->login()->loginNami()->withoutExceptionHandling(); - Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')])->create(); $form = Form::factory() ->name('lala') ->excerpt('fff') @@ -58,8 +57,6 @@ class FormIndexActionTest extends FormTestCase ->assertInertiaPath('data.data.0.links.export', route('form.export', ['form' => $form])) ->assertInertiaPath('data.meta.links.store', route('form.store')) ->assertInertiaPath('data.meta.links.formtemplate_index', route('formtemplate.index')) - ->assertInertiaPath('data.meta.templates.0.name', 'tname') - ->assertInertiaPath('data.meta.templates.0.config.sections.0.name', 'sname') ->assertInertiaPath('data.meta.default.name', '') ->assertInertiaPath('data.meta.default.prevention_conditions', ['mode' => 'all', 'ifs' => []]) ->assertInertiaPath('data.meta.default.prevention_text.version', '1.0') @@ -76,6 +73,27 @@ class FormIndexActionTest extends FormTestCase ->assertInertiaPath('data.meta.section_default.name', ''); } + public function testFormtemplatesHaveData(): void + { + $this->login()->loginNami()->withoutExceptionHandling(); + Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')->fields([ + $this->textField('vorname') + ])]) + ->mailTop(EditorRequestFactory::new()->text(10, 'lala')) + ->mailBottom(EditorRequestFactory::new()->text(10, 'lalb')) + ->create(); + + sleep(1); + $this->get(route('form.index')) + ->assertOk() + ->assertInertiaPath('data.meta.templates.0.name', 'tname') + ->assertInertiaPath('data.meta.templates.0.name', 'tname') + ->assertInertiaPath('data.meta.templates.0.config.sections.0.name', 'sname') + ->assertInertiaPath('data.meta.templates.0.config.sections.0.fields.0.key', 'vorname') + ->assertInertiaPath('data.meta.templates.0.mail_top.blocks.0.data.text', 'lala') + ->assertInertiaPath('data.meta.templates.0.mail_bottom.blocks.0.data.text', 'lalb'); + } + public function testItDisplaysExport(): void { $this->login()->loginNami()->withoutExceptionHandling();