@foreach ($options as $option)
@php($optionHintText = data_get($option, $optionHint))
- filled($optionHintText),
- 'items-center' => blank($optionHintText),
- ])>
- filled($optionHintText),
- 'touch-target' => blank(data_get($option, $optionLabel)) && blank($optionHintText),
- ])>
+
+
except(['class', 'wire:key', 'name', 'id']) }}
+ {{ $attributes->except(['class', 'style', 'wire:key', 'name', 'id']) }}
type="radio"
name="{{ $name }}"
value="{{ data_get($option, $optionValue) }}"
@@ -67,10 +62,10 @@
-
- {{ data_get($option, $optionLabel) }}
+
+ {{ data_get($option, $optionLabel) }}
@if (filled($optionHintText))
- {{ $optionHintText }}
+ {{ $optionHintText }}
@endif
@@ -78,12 +73,12 @@
+
@foreach ($messages as $message)
{{ $message }}
@endforeach
@elseif (filled($hint))
-
{{ $hint }}
+
{{ $hint }}
@endif
diff --git a/tests/Feature/Components/SelectionTest.php b/tests/Feature/Components/SelectionTest.php
index 61a3dbbc..c0c95ba5 100644
--- a/tests/Feature/Components/SelectionTest.php
+++ b/tests/Feature/Components/SelectionTest.php
@@ -31,12 +31,12 @@ it('marks a checkbox that is partly ticked', function () {
it('gives a selection control without a label a 48px target', function () {
expect((string) $this->blade('
'))->toMatch('/
/')
->and((string) $this->blade(' '))->toContain('touch-target')
- ->and((string) $this->blade(' '))->toContain('touch-target');
+ ->and((string) $this->blade(' '))->toMatch('//');
// A labelled control is pressed anywhere along its row, so it needs no extra target.
expect((string) $this->blade(' '))->not->toContain('md-touch-target')
->and((string) $this->blade(' '))->not->toContain('touch-target')
- ->and((string) $this->blade(' '))->not->toContain('touch-target');
+ ->and((string) $this->blade(' '))->not->toContain('md-touch-target');
});
it('leaves a checkbox group to the caller and says how M3 wants it laid out', function () {
@@ -89,8 +89,11 @@ it('draws radio buttons in a fieldset named by its question', function () {
BLADE);
expect($html)
- ->toContain('toContain('Who can open it')
+ ->toMatch('/toContain('Who can open it ')
+ ->toContain('')
+ ->toContain('
Share it separately ')
+ ->not->toContain('class=')
->and(substr_count($html, 'type="radio"'))->toBe(3)
->and(substr_count($html, 'name="audience"'))->toBe(3)
->and(substr_count($html, 'wire:model.live="audience"'))->toBe(3)
@@ -103,7 +106,7 @@ it('names unbound radios after their group and checks the given value', function
$html = (string) $this->blade('
');
expect($html)
- ->toContain('medium:flex')
+ ->toMatch('/
and(substr_count($html, 'name="theme"'))->toBe(2)
->and($html)->toMatch('/value="dark"\s+checked/')
->not->toMatch('/value="light"\s+checked/');
@@ -113,6 +116,7 @@ it('shows the errors of a radio group', function () {
expect((string) $this->withViewErrors(['audience' => ['Choose who can open it.']])
->blade(' '))
->toContain('data-md-invalid')
+ ->toMatch('//')
->toContain('Choose who can open it.');
});
@@ -148,3 +152,13 @@ it('draws the checkbox from its stylesheet, on the row the selection controls sh
->and((string) file_get_contents(__DIR__.'/../../../resources/css/components.css'))->toContain("@import './components/checkbox.css';")
->and((string) file_get_contents(__DIR__.'/../../../resources/css/tailwind.css'))->not->toContain('selection.css');
});
+
+it('lays the radio group out from its stylesheet, inline only from 600px', function () {
+ $css = (string) file_get_contents(__DIR__.'/../../../resources/css/components/radio.css');
+
+ expect($css)->toContain("@import './selection.css';")
+ ->toMatch('/@media \\(width >= 600px\\) \\{\\s*\\[data-md-radio\\]\\[data-md-inline\\] \\[data-md-radio-options\\] \\{\\s*display: flex;/')
+ ->and((string) file_get_contents(__DIR__.'/../../../resources/css/components.css'))->toContain("@import './components/radio.css';")
+ ->and((string) $this->blade(' '))
+ ->toMatch('/data-md-radio\\s+class="mt-4" style="order: 1"/');
+});