blade(''); expect($html) ->toContain('toContain('class="site-balance"') ->toContain('data-balance="hero"') ->toContain('viewBox="0 0 400 400"') ->toContain('role="img"') ->toContain('aria-label="ميزان العدالة"') ->not->toContain('aria-hidden'); }); test('balance without a label is hidden from assistive tech and defaults to static', function () { $html = (string) $this->blade(''); expect($html)->toContain('aria-hidden="true"')->toContain('data-balance="static"')->not->toContain('role="img"'); }); test('size sets width and height and attributes pass through', function () { $html = (string) $this->blade(''); expect($html)->toContain('width="120"')->toContain('height="120"')->toContain('x-extra')->toContain('id="b1"'); }); test('balance script is wired into public.js and ids are made unique per instance', function () { $public = file_get_contents(resource_path('js/public.js')); $balance = file_get_contents(resource_path('js/site/balance.js')); expect($public)->toContain("./site/balance.js"); expect($balance)->toContain('export function init')->toContain('export function destroy') ->toContain('id="gd${i}"')->toContain('id="sh${i}"')->toContain('++uid') ->toContain('rotate(${deg} 200 110)')->toContain('* 0.028')->toContain('prefers-reduced-motion'); }); test('balance css is scoped', function () { expect(file_get_contents(resource_path('css/public.css')))->toContain('body.site .site-balance{display:block;overflow:visible}'); });