fix(wiki): contain long ingredient codes on mobile
Deploy Canina / deploy (push) Successful in 2m10s

This commit is contained in:
devops committed 2026-10-17 11:24:36 +00:00
1 parent 80d9dc2f45
commit 5573bb3568
2 files changed
+17 -1

No files matched your search

@@ -261,7 +261,7 @@ export default function IngredientWiki() {
</div>
<div>
<h3 className="text-base sm:text-2xl font-black text-medical-gray-900 leading-tight font-vazir">{ing.name}</h3>
<span className="text-[12px] text-canina-blue font-bold tracking-wider font-vazir inline-block mt-1 bg-canina-blue/5 px-2.5 py-0.5 rounded-lg border border-canina-blue/10">کد ماده مؤثره: <span className="font-mono">{ing.id}</span></span>
<span data-testid="wiki-ingredient-code" className="text-[10px] sm:text-[12px] text-canina-blue font-bold tracking-normal sm:tracking-wider font-vazir inline-block max-w-full mt-1 bg-canina-blue/5 px-2 py-0.5 rounded-lg border border-canina-blue/10 break-all">کد ماده مؤثره: <span className="font-mono">{ing.id}</span></span>
</div>
</div>
@@ -290,4 +290,20 @@ describe('IngredientWiki Component', () => {
expect(container.firstElementChild).not.toHaveClass('py-12');
});
it('wraps long ingredient codes inside the mobile card', async () => {
(productService.getProducts as any).mockResolvedValueOnce({ data: [] });
(api.get as any).mockResolvedValueOnce({ data: [{
id: 'beef-broth-279-spray-dried',
slug: 'beef-broth-279-spray-dried',
nameFa: 'آب گوشت گاو',
description: 'توضیح',
benefits: [],
}] });
render(<IngredientWiki />);
await waitFor(() => expect(screen.getByText('آب گوشت گاو')).toBeInTheDocument());
expect(screen.getByTestId('wiki-ingredient-code')).toHaveClass('max-w-full', 'break-all');
});
});