test(portal): pin staff-template styling and safe resource rules

This commit is contained in:
AIAMarketing authored and Jeff Hales committed 2026-11-01 14:05:35 -07:00
1 parent 81d1f21236
commit 4d7955fb48
1 file changed
+12
+12
View File
@@ -45,6 +45,18 @@ test('portal presentation translates only explicit button tokens/brand fills and
assert.equal(portalLinkPresentation([], '', 'tel:'), 'portal-contact-link');
});
test('staff template presentation follows sanitized headings, not original HubSpot classes', async () => {
const renderer = await fs.readFile('src/scripts/employee-portal.ts', 'utf8');
const css = await fs.readFile('src/components/pages/EmployeePortal.astro', 'utf8');
assert.match(renderer, /enhanceStaffPortalPresentation\(output\)/);
assert.match(renderer, /'management templates'/);
assert.match(renderer, /fragment\.querySelectorAll<HTMLAnchorElement>\('a\[href\]'\)/);
assert.match(renderer, /templatesList\?\.classList\.add\('portal-template-grid'\)/);
assert.match(css, /grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)/);
assert.match(css, /@media \(max-width: 767px\)/);
assert.match(css, /ul\.portal-template-grid a\.portal-resource-button/);
});
test('global preference validates expiry, corrupted values and clock anomalies', () => {
const now = 10000000000;
for (const raw of [null, '', 'NaN', '-1', '1.5', 'Infinity', String(now), String(now - 1), String(now + suppressionDuration + 1)]) assert.equal(isSuppressed(raw, now), false);