42 lines
1.9 KiB
JavaScript
42 lines
1.9 KiB
JavaScript
'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 Zibll 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, /<div class="icon-card /);
|
|
assert.match(helper, /<div class="icon-cover-card flex ac /);
|
|
assert.match(helper, /icon-cover-icon badg cir/);
|
|
assert.match(helper, /icon-cover-desc ml10 flex1 px12-sm/);
|
|
assert.doesNotMatch(helper, /aksrt-icon-cover-card/);
|
|
assert.match(widgets, /'customize_icon' => \$card\['customize_icon'\] \?\? ''/);
|
|
assert.match(widgets, /'custom_icon'\s+=> \$card\['custom_icon'\] \?\? ''/);
|
|
assert.match(widgets, /'icon_image'\s+=> \$card\['icon_image'\] \?\? ''/);
|
|
assert.match(header, /empty\(\$card\['custom_icon'\]\)/);
|
|
});
|
|
|
|
test('homepage horizontal cards render fully from Zibll 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/);
|
|
});
|