fix(modal): use checkbox ids for Livewire bindings (#11335)
This commit is contained in:
parent
3d025a2a9b
commit
69dbfe0079
2 changed files with 16 additions and 1 deletions
|
|
@ -236,7 +236,6 @@ class="flex size-7 shrink-0 items-center justify-center rounded-md text-neutral-
|
|||
@foreach ($checkboxes as $index => $checkbox)
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
<x-forms.checkbox fullWidth :label="$checkbox['label']" :id="$checkbox['id']"
|
||||
:wire:model="$checkbox['id']"
|
||||
x-on:change="toggleAction('{{ $checkbox['id'] }}')" :checked="$this->{$checkbox['id']}"
|
||||
x-bind:checked="selectedActions.includes('{{ $checkbox['id'] }}')" />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
|
||||
/**
|
||||
* Step 1 (checkbox options) should only show Continue — dismiss is the header X.
|
||||
*/
|
||||
|
|
@ -13,3 +15,17 @@
|
|||
->toContain('step1ButtonText')
|
||||
->not->toContain('Cancel');
|
||||
});
|
||||
|
||||
test('modal confirmation lets checkbox ids define their Livewire model binding', function () {
|
||||
$checkbox = Blade::render(<<<'BLADE'
|
||||
<x-forms.checkbox id="deleteVolumes"
|
||||
x-on:change="toggleAction('deleteVolumes')"
|
||||
x-bind:checked="selectedActions.includes('deleteVolumes')" />
|
||||
BLADE);
|
||||
|
||||
expect($checkbox)
|
||||
->toContain('x-on:change="toggleAction(\'deleteVolumes\')"')
|
||||
->toContain('x-bind:checked="selectedActions.includes(\'deleteVolumes\')"')
|
||||
->toContain('wire:model=deleteVolumes')
|
||||
->toMatch('/id="deleteVolumes-[a-zA-Z0-9]{24}"/');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue