fix(widgets): restore article list rendering and reference styles
This commit is contained in:
1 parent
4ea00f1322
commit
fc04bf65e6
18 files changed
+345
-97
No files matched your search
@@ -0,0 +1,37 @@
|
||||
'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('article list uses the reference widget container and keeps widget behavior classes', () => {
|
||||
const renderer = read('src/WidgetSystem/FrontendRenderer.php');
|
||||
const catalog = read('src/WidgetSystem/WidgetCatalog.php');
|
||||
assert.match(renderer, /\['user_card', 'author_card', 'tab_posts', 'posts'\]/);
|
||||
assert.match(renderer, /\$classes = \['zib-widget-wrap', 'aksrt-' \. str_replace/);
|
||||
assert.match(renderer, /echo '<div class="widget-container"><div>'/);
|
||||
assert.match(renderer, /WidgetVisibility::device_class\(\$instance\)/);
|
||||
assert.match(renderer, /!empty\(\$instance\['sidebar_affix'\]\)/);
|
||||
assert.match(renderer, /data-affix="true"/);
|
||||
assert.match(catalog, /in_array\(\$slug, \['buttons', 'notice', 'posts'\], true\)/);
|
||||
});
|
||||
|
||||
test('article list pagination shares the reference widget rules and obsolete trigger CSS is removed', () => {
|
||||
const css = read('assets/widgets/frontend.css');
|
||||
assert.match(css, /\.widget-tab-post \.pagenav, \.widget-main-post \.pagenav/);
|
||||
assert.match(css, /\.sidebar :is\(\.widget-tab-post, \.widget-main-post\) \.pagenav/);
|
||||
assert.match(css, /:is\(\.widget-tab-post, \.widget-main-post\) \.pagenav a\.page-numbers/);
|
||||
assert.doesNotMatch(css, /\.post_ajax_trigger/);
|
||||
for (const token of [
|
||||
'.widget-tab-post .item-heading, .widget-main-post .item-heading',
|
||||
'.widget-tab-post .item-heading.font-bold, .widget-main-post .item-heading.font-bold',
|
||||
'.widget-tab-post .posts-mini, .widget-main-post .posts-mini',
|
||||
'.widget-tab-post .posts-mini-con, .widget-main-post .posts-mini-con',
|
||||
'.widget-tab-post .item-meta .meta-pay, .widget-main-post .item-meta .meta-pay',
|
||||
'.aksrt-posts-wrap :where(a, button, input, select, textarea, [tabindex]):focus-visible',
|
||||
]) assert.ok(css.includes(token), `missing shared widget rule: ${token}`);
|
||||
});
|
||||
Reference in new issue
Block a user