Compare commits

..

No commits in common. "56e02234929cfe8cc2a4daa4f964010782e5813c" and "93d4511ee8149be75727c7683871ac5b81927f12" have entirely different histories.

4 changed files with 3 additions and 23 deletions

View File

@ -17,6 +17,6 @@ class EmailField extends TextField
*/ */
public function getRegistrationRules(Form $form): array public function getRegistrationRules(Form $form): array
{ {
return [$this->key => $this->required ? ['required', 'string', 'email'] : ['nullable', 'email', 'string']]; return [$this->key => $this->required ? ['required', 'string', 'email'] : ['nullable', 'string']];
} }
} }

View File

@ -254,18 +254,6 @@ class FormRegisterActionTest extends FormTestCase
['vorname' => 5], ['vorname' => 5],
['vorname' => 'Vorname der Mutter muss ein String sein.'] ['vorname' => 'Vorname der Mutter muss ein String sein.']
]; ];
yield [
$this->emailField('email')->name('Mail')->required(true),
['email' => 'alaaa'],
['email' => 'Mail muss eine gültige E-Mail-Adresse sein.']
];
yield [
$this->emailField('email')->name('Mail')->required(false),
['email' => 'alaaa'],
['email' => 'Mail muss eine gültige E-Mail-Adresse sein.']
];
} }
public function testItValidatesGroupFieldWithParentGroupField(): void public function testItValidatesGroupFieldWithParentGroupField(): void

View File

@ -42,16 +42,14 @@ class FormRegisterMailTest extends FormTestCase
FormtemplateSectionRequest::new()->name('Persönliches')->fields([ FormtemplateSectionRequest::new()->name('Persönliches')->fields([
$this->textField('vorname')->name('Vorname')->specialType(SpecialType::FIRSTNAME), $this->textField('vorname')->name('Vorname')->specialType(SpecialType::FIRSTNAME),
$this->textField('nachname')->specialType(SpecialType::LASTNAME), $this->textField('nachname')->specialType(SpecialType::LASTNAME),
$this->checkboxField('fullyear')->name('Volljährig'),
]) ])
])) ]))
->data(['vorname' => 'Max', 'nachname' => 'Muster', 'fullyear' => true]) ->data(['vorname' => 'Max', 'nachname' => 'Muster'])
->create(); ->create();
$mail = new ConfirmRegistrationMail($participant); $mail = new ConfirmRegistrationMail($participant);
$mail->assertSeeInText('# Hallo Max Muster'); $mail->assertSeeInText('# Hallo Max Muster');
$mail->assertSeeInText('## Persönliches'); $mail->assertSeeInText('## Persönliches');
$mail->assertSeeInText('* Vorname: Max'); $mail->assertSeeInText('* Vorname: Max');
$mail->assertSeeInText('* Volljährig: Ja');
} }
} }

View File

@ -6,7 +6,6 @@ use App\Form\Fields\CheckboxesField;
use App\Form\Fields\CheckboxField; use App\Form\Fields\CheckboxField;
use App\Form\Fields\DateField; use App\Form\Fields\DateField;
use App\Form\Fields\DropdownField; use App\Form\Fields\DropdownField;
use App\Form\Fields\EmailField;
use App\Form\Fields\GroupField; use App\Form\Fields\GroupField;
use App\Form\Fields\NamiField; use App\Form\Fields\NamiField;
use App\Form\Fields\RadioField; use App\Form\Fields\RadioField;
@ -27,11 +26,6 @@ trait CreatesFormFields
return FormtemplateFieldRequest::type(TextField::class)->key($key ?? $this->randomKey()); return FormtemplateFieldRequest::type(TextField::class)->key($key ?? $this->randomKey());
} }
protected function emailField(?string $key = null): FormtemplateFieldRequest
{
return FormtemplateFieldRequest::type(EmailField::class)->key($key ?? $this->randomKey());
}
protected function checkboxesField(?string $key = null): FormtemplateFieldRequest protected function checkboxesField(?string $key = null): FormtemplateFieldRequest
{ {
return FormtemplateFieldRequest::type(CheckboxesField::class)->key($key ?? $this->randomKey()); return FormtemplateFieldRequest::type(CheckboxesField::class)->key($key ?? $this->randomKey());
@ -69,6 +63,6 @@ trait CreatesFormFields
protected function randomKey(): string protected function randomKey(): string
{ {
return preg_replace('/[\-0-9]/', '', str()->uuid() . str()->uuid()); return preg_replace('/[\-0-9]/', '', str()->uuid().str()->uuid());
} }
} }