2023-12-22 20:40:24 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Feature\Form;
|
|
|
|
|
2023-12-26 00:44:49 +01:00
|
|
|
use App\Form\Models\Formtemplate;
|
2023-12-22 20:40:24 +01:00
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class FormtemplateIndexActionTest extends TestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function testItDisplaysIndexPage(): void
|
|
|
|
{
|
2023-12-26 00:44:49 +01:00
|
|
|
$formtemplate = Formtemplate::factory()->create();
|
|
|
|
|
2023-12-22 20:40:24 +01:00
|
|
|
$this->login()->loginNami()->withoutExceptionHandling();
|
|
|
|
|
|
|
|
$this->get(route('formtemplate.index'))
|
2023-12-26 00:44:49 +01:00
|
|
|
->assertInertiaPath('data.data.0.links', [
|
|
|
|
'update' => route('formtemplate.update', ['formtemplate' => $formtemplate]),
|
|
|
|
])
|
2023-12-26 20:06:57 +01:00
|
|
|
->assertInertiaPath('data.meta.fields.2', [
|
2023-12-26 00:44:49 +01:00
|
|
|
'id' => 'DropdownField',
|
|
|
|
'name' => 'Dropdown',
|
|
|
|
'default' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => 'DropdownField',
|
2023-12-26 20:06:57 +01:00
|
|
|
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
|
|
|
'default' => null,
|
2023-12-26 00:44:49 +01:00
|
|
|
'required' => false,
|
|
|
|
'options' => [],
|
|
|
|
]
|
|
|
|
])
|
2023-12-26 20:06:57 +01:00
|
|
|
->assertInertiaPath('data.meta.fields.4', [
|
2023-12-22 20:40:24 +01:00
|
|
|
'id' => 'TextField',
|
|
|
|
'name' => 'Text',
|
2023-12-25 19:35:00 +01:00
|
|
|
'default' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => 'TextField',
|
2023-12-26 20:06:57 +01:00
|
|
|
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
2023-12-25 19:35:00 +01:00
|
|
|
'default' => '',
|
|
|
|
'required' => false,
|
|
|
|
]
|
2023-12-22 20:40:24 +01:00
|
|
|
])
|
2023-12-26 20:06:57 +01:00
|
|
|
->assertInertiaPath('data.meta.fields.5', [
|
2023-12-26 00:44:49 +01:00
|
|
|
'id' => 'TextareaField',
|
|
|
|
'name' => 'Textarea',
|
|
|
|
'default' => [
|
|
|
|
'name' => '',
|
|
|
|
'type' => 'TextareaField',
|
2023-12-26 20:06:57 +01:00
|
|
|
'columns' => ['mobile' => 2, 'tablet' => 4, 'desktop' => 6],
|
2023-12-26 00:44:49 +01:00
|
|
|
'default' => '',
|
|
|
|
'required' => false,
|
|
|
|
'rows' => 5,
|
|
|
|
]
|
|
|
|
])
|
2023-12-22 20:40:24 +01:00
|
|
|
->assertInertiaPath('data.meta.default', [
|
|
|
|
'name' => '',
|
|
|
|
'config' => [
|
|
|
|
'sections' => [],
|
|
|
|
]
|
|
|
|
])
|
|
|
|
->assertInertiaPath('data.meta.links.store', route('formtemplate.store'))
|
|
|
|
->assertInertiaPath('data.meta.section_default', [
|
2023-12-25 19:35:00 +01:00
|
|
|
'name' => '',
|
|
|
|
'intro' => '',
|
2023-12-22 20:40:24 +01:00
|
|
|
'fields' => [],
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|