'use strict'; const assert = require('node:assert/strict'); const fs = require('node:fs'); const path = require('node:path'); const test = require('node:test'); const root = path.resolve(__dirname, '..', '..'); const read = (file) => fs.readFileSync(path.join(root, file), 'utf8'); test('icon card renderers keep vertical and horizontal legacy DOM contracts separate', () => { const helper = read('inc/helpers/aksrt-icon-cards.php'); const widgets = read('src/WidgetSystem/Renderers/GeneralRenderer.php'); const header = read('inc/helpers/homepage/header-components.php'); assert.match(helper, /
\$card\['customize_icon'\] \?\? ''/); assert.doesNotMatch(widgets, /\$card\['custom_icon'\]/); assert.doesNotMatch(widgets, /\$card\['icon_image'\]/); assert.doesNotMatch(widgets, /\$card\['description'\]/); assert.match(header, /empty\(\$card\['custom_icon'\]\)/); }); test('homepage horizontal cards render fully from legacy CSS with no dedicated stylesheet', () => { const baseCss = read('assets/css/frontend/base.css'); const widgetCss = read('assets/widgets/frontend.css'); const scripts = read('src/Core/ScriptsPart1b.php'); assert.equal(fs.existsSync(path.join(root, 'assets/css/frontend/header-cards.css')), false); assert.doesNotMatch(baseCss, /\.icon-cover-card\.aksrt-icon-cover-card/); assert.doesNotMatch(baseCss, /\.header-components-card/); assert.match( baseCss, /\.header-slider-card\s+\.icon-cover-card\s*\{[^}]*font-size:\s*12px/s, ); assert.doesNotMatch(scripts, /header-cards/); assert.doesNotMatch(widgetCss, /aksrt-widget-icon-cards \.icon-cover-card/); }); test('widget icon cards restore the reference surface height without compact overrides', () => { const widgetCss = read('assets/widgets/frontend.css'); assert.match( widgetCss, /\.zib-widget\s*\{[^}]*margin-bottom:\s*20px[^}]*padding:\s*15px[^}]*box-shadow:\s*0 0 10px/s, ); assert.match(widgetCss, /\.zib-widget\.padding-10\s*\{\s*padding:\s*10px/); assert.match(widgetCss, /\.zib-widget\.nobottom\.notop\s*\{[^}]*padding-top:\s*0[^}]*padding-bottom:\s*0/s); assert.doesNotMatch(widgetCss, /\.row\.gutters-5/); assert.doesNotMatch(widgetCss, /\.icon-card\s*,\s*\.icon-cover-card\s*\{\s*font-size:\s*12px/); assert.doesNotMatch(widgetCss, /\.icon-cover-card\s*\{[^}]*padding-(?:top|bottom)/s); }); test('header icon-card defaults use bundled Font Awesome icons', () => { const defaults = [ read('src/Admin/Schema/SchemaPageDisplay.php'), read('src/Admin/PageConfigMetaBox.php'), read('src/Settings/DisplayPageGroups.php'), ]; for (const source of defaults) { assert.doesNotMatch(source, /'icon'\s*=>\s*'zibsvg-/); for (const icon of ['gem', 'star', 'fire', 'wrench']) { assert.match(source, new RegExp(`'icon'\\s*=>\\s*'fa fas fa-${icon}'`)); } } });