Fix: Update section intro
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
3f3ecf0071
commit
f03459de58
|
@ -18,6 +18,7 @@ trait HasValidation
|
|||
'name' => 'required|string|max:255',
|
||||
'config' => 'array',
|
||||
'config.sections.*.name' => 'required',
|
||||
'config.sections.*.intro' => 'nullable|string',
|
||||
'config.sections.*.fields' => 'array',
|
||||
'config.sections.*.fields.*.name' => 'required|string',
|
||||
'config.sections.*.fields.*.type' => ['required', 'string', Rule::in(array_column(Field::asMeta(), 'id'))],
|
||||
|
|
|
@ -15,7 +15,8 @@ class SectionData extends Data
|
|||
public string $name,
|
||||
#[WithCast(FieldCollectionCast::class)]
|
||||
#[WithTransformer(FieldCollectionTransformer::class)]
|
||||
public FieldCollection $fields
|
||||
public FieldCollection $fields,
|
||||
public ?string $intro
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,20 @@ class FormUpdateActionTest extends FormTestCase
|
|||
$this->assertEquals(['firstname'], $form->fresh()->meta['active_columns']);
|
||||
}
|
||||
|
||||
public function testItUpdatesIntroOfSections(): void
|
||||
{
|
||||
$this->login()->loginNami()->withoutExceptionHandling();
|
||||
$form = Form::factory()
|
||||
->sections([FormtemplateSectionRequest::new()->intro('aaa')])
|
||||
->create();
|
||||
$payload = FormRequest::new()->sections([
|
||||
FormtemplateSectionRequest::new()->intro('aaa')
|
||||
])->create();
|
||||
|
||||
$this->patchJson(route('form.update', ['form' => $form]), $payload)->assertSessionDoesntHaveErrors()->assertOk();
|
||||
$this->assertEquals('aaa', $form->fresh()->config->sections[0]->intro);
|
||||
}
|
||||
|
||||
public function testItUpdatesActiveState(): void
|
||||
{
|
||||
$this->login()->loginNami()->withoutExceptionHandling();
|
||||
|
|
|
@ -16,6 +16,7 @@ class FormtemplateSectionRequest extends RequestFactory
|
|||
{
|
||||
return [
|
||||
'name' => $this->faker->words(5, true),
|
||||
'intro' => '',
|
||||
'fields' => [],
|
||||
];
|
||||
}
|
||||
|
@ -28,6 +29,11 @@ class FormtemplateSectionRequest extends RequestFactory
|
|||
return $this->state(['fields' => $fields]);
|
||||
}
|
||||
|
||||
public function intro(string $intro): self
|
||||
{
|
||||
return $this->state(['intro' => $intro]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $args
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue