Add mail data from template to form
continuous-integration/drone/push Build was killed Details

This commit is contained in:
philipp lang 2024-07-15 17:13:23 +02:00
parent 607038af6b
commit 5641006e2b
2 changed files with 23 additions and 3 deletions

View File

@ -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) {

View File

@ -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();