Say a field is in error twice, and stop dashing a read-only one
M3 wants two visual indicators per state and names the pair for a text field: the error colours and a trailing error icon. The field now draws one, labelled "Error", unless the caller already trails it or the field is xs. A read-only field loses its dashed outline: M3 keeps "the same visual style as an editable field", and the native readonly attribute is what tells a screen reader. The data-readonly hook stays. Plan step 20, findings IN-18 and IN-19. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
42d62ed00c
commit
856b6f476b
@@ -45,6 +45,20 @@ it('replaces the hint with the errors for its model', function () {
|
||||
->not->toContain('We never share it');
|
||||
});
|
||||
|
||||
it('pairs the error colours with a trailing error icon', function () {
|
||||
$errors = ['email' => ['Enter a valid email address.']];
|
||||
|
||||
expect((string) $this->withViewErrors($errors)->blade('<x-input id="email" label="Email" wire:model="email" />'))
|
||||
->toContain('field-trailing field-error')
|
||||
->toContain('aria-label="Error"')
|
||||
->and((string) $this->withViewErrors($errors)->blade('<x-input id="email" label="Email" size="xs" wire:model="email" />'))
|
||||
->not->toContain('field-error')
|
||||
->and((string) $this->withViewErrors($errors)->blade('<x-input id="email" label="Email" icon-right="info" wire:model="email" />'))
|
||||
->not->toContain('field-error')
|
||||
->and((string) $this->blade('<x-input id="email" label="Email" />'))
|
||||
->not->toContain('field-error');
|
||||
});
|
||||
|
||||
it('puts icons, affixes and the size on the field, and every other attribute on the input', function () {
|
||||
$html = (string) $this->blade('<x-input label="Price" icon="payments" icon-right="info" prefix="CHF" suffix="per month" size="sm" type="number" min="0" class="w-40" mono readonly />');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user