Put the badge on M3's anchor geometry and a visible edge
A floating dot sat 2px inside the icon's top-trailing corner where M3 puts it flush, and a floating count 4px above it where M3 says 2px. An `outline` status label drew its edge in outline-variant, the decorative role dividers use, which is about 1.5:1 on surface — M3 asks a badge for 3:1, so it takes `outline`. Plan step 18, actions.md ACT-23, ACT-24. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
This commit is contained in:
co-authored by
Claude Opus 5
parent
c33d90c653
commit
56d82b71f3
@@ -14,9 +14,9 @@ it('is M3\'s large badge with a count, capped by max', function () {
|
||||
});
|
||||
|
||||
it('pins itself to the corner of an icon when floating', function () {
|
||||
expect((string) $this->blade('<x-badge floating />'))->toContain('absolute top-0.5 end-0.5')
|
||||
expect((string) $this->blade('<x-badge floating />'))->toContain('absolute top-0 end-0')
|
||||
->and((string) $this->blade('<x-badge value="3" floating label="3 new messages" />'))
|
||||
->toContain('absolute -top-1')
|
||||
->toContain('absolute -top-0.5')
|
||||
->toContain('aria-label="3 new messages"')
|
||||
->not->toContain('aria-hidden');
|
||||
});
|
||||
@@ -27,7 +27,7 @@ it('draws a status label in a container or an outline', function () {
|
||||
->toContain('bg-success-container text-on-success-container')
|
||||
->not->toContain('aria-hidden')
|
||||
->and((string) $this->blade('<x-badge value="Pro" outline />'))
|
||||
->toContain('border border-outline-variant text-on-surface-variant')
|
||||
->toContain('border border-outline text-on-surface-variant')
|
||||
->not->toContain('bg-error');
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ it('draws neutral ink on every variant', function () {
|
||||
expect((string) $this->blade('<x-badge color="neutral" />'))->toContain('size-1.5 rounded-corner-full bg-on-surface-variant text-surface')
|
||||
->and((string) $this->blade('<x-badge value="7" color="neutral" />'))->toContain('tabular-nums bg-on-surface-variant text-surface')
|
||||
->and((string) $this->blade('<x-badge value="Draft" tone="neutral" tonal />'))->toContain('type-label-md bg-surface-container-high text-on-surface-variant')
|
||||
->and((string) $this->blade('<x-badge value="Draft" color="neutral" outline />'))->toContain('type-label-md border border-outline-variant text-on-surface-variant');
|
||||
->and((string) $this->blade('<x-badge value="Draft" color="neutral" outline />'))->toContain('type-label-md border border-outline text-on-surface-variant');
|
||||
});
|
||||
|
||||
it('leaves a plain badge to the caller\'s colour classes', function (string $badge, string $shape) {
|
||||
@@ -73,7 +73,7 @@ it('keeps its default colours, and falls back to error on a colour it does not k
|
||||
->and((string) $this->blade('<x-badge value="Active" tonal />'))
|
||||
->toContain('class="inline-flex shrink-0 items-center justify-center whitespace-nowrap h-6 gap-1 rounded-corner-sm px-2 type-label-md bg-error-container text-on-error-container"')
|
||||
->and((string) $this->blade('<x-badge value="Pro" outline color="success" />'))
|
||||
->toContain('class="inline-flex shrink-0 items-center justify-center whitespace-nowrap h-6 gap-1 rounded-corner-sm px-2 type-label-md border border-outline-variant text-on-surface-variant"')
|
||||
->toContain('class="inline-flex shrink-0 items-center justify-center whitespace-nowrap h-6 gap-1 rounded-corner-sm px-2 type-label-md border border-outline text-on-surface-variant"')
|
||||
->and((string) $this->blade('<x-badge value="3" color="sport-run" />'))->toContain('bg-error text-on-error');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user