mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-20 06:23:23 +00:00
fix(modal): use checkbox ids for Livewire bindings (#11335)
This commit is contained in:
@@ -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}"/');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user