Check square icon mask within the shared 24px sidebar flex slot

This commit is contained in:
pavlov346346-source 2026-09-19 08:14:52 +03:00
parent 9f6ed42b0a
commit b6e4a1aaad

View File

@ -85,10 +85,13 @@ test('Help uses a question-circle mask with the native sidebar icon geometry and
return {normal,active,viewBox:svg?.documentElement.getAttribute('viewBox'),fill:svg?.documentElement.getAttribute('fill'),stroke:svg?.documentElement.getAttribute('stroke-width'),circle:svg?.querySelector('circle')?.getAttribute('r'),question:svg?.querySelector('path')?.getAttribute('d')};
});
expect(result.viewBox).toBe('0 0 24 24');expect(result.fill).toBe('none');expect(result.stroke).toBe('1.9');expect(result.circle).toBe('9');expect(result.question).toContain('M12 17h.01');
// Compare against the final app styles rather than an intermediate 20px rule.
expect(result.normal.help).toEqual(result.normal.peer);expect(result.active.help).toEqual(result.active.peer);
expect(parseFloat(result.normal.help.width)).toBeGreaterThanOrEqual(16);
expect(result.normal.help.width).toBe(result.normal.help.height);
// The shared legacy flex basis reserves 24px, while the mask itself is square.
// Validate the actual drawn mask, not an assumed square layout slot.
const [maskWidth,maskHeight=maskWidth]=result.normal.help.maskSize.split(/\s+/).map(parseFloat);
expect(maskWidth).toBeGreaterThanOrEqual(16);expect(maskWidth).toBe(maskHeight);
expect(maskWidth).toBeLessThanOrEqual(parseFloat(result.normal.help.width));
expect(maskHeight).toBeLessThanOrEqual(parseFloat(result.normal.help.height));
await expect(help.locator('svg,img')).toHaveCount(0);
await expect(help).toHaveText('Помощь');
});