Ensure eula field enabled when not using default eula

This commit is contained in:
Marcus Moore 2023-08-02 18:02:56 -07:00
parent 2e7aa01abe
commit 3fd0853fd0
No known key found for this signature in database
2 changed files with 12 additions and 3 deletions

View file

@ -22,7 +22,7 @@ class CategoryEditForm extends Component
$this->originalSendCheckInEmailValue = $this->sendCheckInEmail;
if ($this->eulaText || $this->useDefaultEula) {
$this->sendCheckInEmail = true;
$this->sendCheckInEmail = 1;
}
}
@ -37,7 +37,7 @@ class CategoryEditForm extends Component
return;
}
$this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? true : $this->originalSendCheckInEmailValue;
$this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue;
}
public function getShouldDisplayEmailMessageProperty(): bool
@ -56,7 +56,7 @@ class CategoryEditForm extends Component
public function getEulaTextDisabledProperty()
{
return $this->useDefaultEula;
return (bool) $this->useDefaultEula;
}
public function getSendCheckInEmailDisabledProperty()

View file

@ -93,4 +93,13 @@ class CategoryEditFormTest extends TestCase
->assertSet('sendCheckInEmail', true)
->assertSet('sendCheckInEmailDisabled', false);
}
public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula()
{
Livewire::test(CategoryEditForm::class, [
'sendCheckInEmail' => false,
'eulaText' => '',
'useDefaultEula' => false,
])->assertSet('eulaTextDisabled', false);
}
}