5180 fichiers 38.5 Mo 0 téléchargements 202 vues mis à jour il y a 5 heures ui
nitro-v36-with-renderer-v36 / src / components / catalog / catalogLocalization.helpers.test.ts
catalogLocalization.helpers.test.ts 1.2 Ko Télécharger le fichier
import { describe, expect, it } from 'vitest';
import { getCatalogHeaderDescription, getCatalogTextElementName } from './catalogLocalization.helpers';

const localization = (texts: string[]) => ({ getText: (index: number) => texts[index] ?? '' }) as any;

describe('standard catalog page localization mapping', () => {
    it('uses the first default text as the catalog header description', () => {
        expect(getCatalogTextElementName(0, 'default_3x3')).toBe('catalog.header.description');
        expect(getCatalogHeaderDescription('default_3x3', localization(['Header copy', 'Product copy']))).toBe('Header copy');
    });

    it('does not leak page content into the header for specialized layouts', () => {
        expect(getCatalogTextElementName(0, 'frontpage4')).toBe('ctlg_txt1');
        expect(getCatalogTextElementName(0, 'trophies')).toBe('trophy.description');
        expect(getCatalogTextElementName(0, 'builders_club_frontpage')).toBe('ctlg_description');
        expect(getCatalogHeaderDescription('frontpage4', localization(['Front-page body']))).toBe('');
        expect(getCatalogHeaderDescription('trophies', localization(['Trophy body']))).toBe('');
    });
});
15Sujets
1Dépôts
20Membres
2En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser