feat: implement Theme Builder concept and Display Conditions resolver system
This commit is contained in:
@@ -66,4 +66,34 @@ describe('WaaS Engine Core Unit Tests', () => {
|
||||
const desktopConfig = loadWaasConfigs('Mozilla/5.0 (Windows NT 10.0; Win64; x64)');
|
||||
expect(desktopConfig.siteConfig.siteName).toBe('Desktop Site');
|
||||
});
|
||||
|
||||
it('6. Should correctly resolve Theme Builder template based on Display Conditions', async () => {
|
||||
const { resolveTemplate } = await import('../src/utils/conditionResolver');
|
||||
const templates = [
|
||||
{
|
||||
id: 'header-global',
|
||||
name: 'Global Header',
|
||||
type: 'header' as const,
|
||||
status: 'published' as const,
|
||||
priority: 1,
|
||||
conditions: [{ type: 'include' as const, scope: 'entire_site' as const }]
|
||||
},
|
||||
{
|
||||
id: 'header-custom-page',
|
||||
name: 'Custom Page Header',
|
||||
type: 'header' as const,
|
||||
status: 'published' as const,
|
||||
priority: 1,
|
||||
conditions: [{ type: 'include' as const, scope: 'singular' as const, entityId: 'landing_1' }]
|
||||
}
|
||||
];
|
||||
|
||||
// Global matching
|
||||
const matchGlobal = resolveTemplate(templates, 'header', { url: '/about', routeType: 'singular', entityId: 'about_page' });
|
||||
expect(matchGlobal?.id).toBe('header-global');
|
||||
|
||||
// Specific page matching
|
||||
const matchSpecific = resolveTemplate(templates, 'header', { url: '/landing', routeType: 'singular', entityId: 'landing_1' });
|
||||
expect(matchSpecific?.id).toBe('header-custom-page');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user