blade(''); expect($html) ->toContain('data-md-loading') ->toContain('role="progressbar"') ->toContain('aria-label="Loading"') ->toContain('toMatch('/toMatch('/not->toContain('class='); }); it('is 48px in the primary colour unless the caller sizes or colours it', function () { $css = ComponentStylesheet::read('loading'); expect($css->declarations('[data-md-loading]')) ->toMatchArray(['inline-size' => '48px', 'block-size' => '48px', 'color' => 'var(--md-sys-color-primary)']) // A caller's class lands on the root untouched, and outranks the package's layer. ->and((string) $this->blade('')) ->toContain('class="size-24 text-tertiary"') ->toContain('aria-label="Uploading"'); }); it('sits on a primary-container circle when contained', function () { expect((string) $this->blade(''))->toContain('data-md-contained') ->and((string) $this->blade(''))->not->toContain('data-md-contained') ->and(ComponentStylesheet::read('loading')->declarations('[data-md-loading][data-md-contained]'))->toBe([ 'border-radius' => 'var(--md-sys-shape-corner-full)', 'background-color' => 'var(--md-sys-color-primary-container)', 'color' => 'var(--md-sys-color-on-primary-container)', ]); }); it('rests the same shape under reduced motion', function () { $css = ComponentStylesheet::read('loading'); expect($css->declarations('[data-md-loading] > [data-md-loading-still]'))->toBe(['display' => 'none']) ->and($css->declarations('[data-md-loading] > [data-md-loading-animated]', ['@media (prefers-reduced-motion: reduce)']))->toBe(['display' => 'none']) ->and($css->declarations('[data-md-loading] > [data-md-loading-still]', ['@media (prefers-reduced-motion: reduce)']))->toBe(['display' => 'block']); }); it('says nothing where something else already does', function () { expect((string) $this->blade('')) ->toContain('aria-hidden="true"') ->not->toContain('role="progressbar"'); expect((string) $this->blade('')) ->toContain('not->toContain('role="progressbar"'); }); it('animates without script and rests the same shape', function () { $animated = file_get_contents(__DIR__.'/../../../resources/svg/loading-indicator/indeterminate.svg'); $static = file_get_contents(__DIR__.'/../../../resources/svg/loading-indicator/static.svg'); expect($animated)->toStartWith('') ->toContain('repeatCount="indefinite"') ->not->toContain('