fix(modal): use checkbox ids for Livewire bindings (#11335)

This commit is contained in:
Andras Bacsai
2026-08-17 23:34:56 +02:00
committed by GitHub
parent 3d025a2a9b
commit 69dbfe0079
2 changed files with 16 additions and 1 deletions
@@ -236,7 +236,6 @@
@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 @@ test('modal confirmation step 1 does not render a cancel button', function () {
->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}"/');
});