fix(widgets): restore article list rendering and reference styles

This commit is contained in:
kate522 committed 2026-10-30 12:47:07 +08:00
1 parent 4ea00f1322
commit fc04bf65e6
18 files changed
+345 -97

No files matched your search

@@ -33,15 +33,15 @@ test('un-normalized missing and invalid style use one shared mini resolution in
}
});
test('mini options render thumbnail, rank, author and meta on both pages with continuous numbering', () => {
test('mini options render thumbnail, rank, author and meta; rank is limited to the first page', () => {
const current = render().mini_all_options;
assert.equal((current.first.match(/class="posts-mini ajax-item"/g) || []).length, 4);
assert.match(current.first, /class="mr10"><div class="item-thumbnail"/);
assert.match(current.first, /badg badg-sm mr3 c-red">1<\/span>/);
assert.match(current.first, /class="meta-author flex ac"/);
assert.match(current.first, /class="item-meta muted-2-color flex jsb ac/);
assert.match(current.second, /badg badg-sm mr3 c-green">5<\/span>/);
assert.match(current.second, /真实文章 36/);
assert.doesNotMatch(current.second, /class="badg badg-sm/);
assert.match(current.second, /真实文章 32/);
assert.doesNotMatch(current.first + current.second, /class="posts-row|class="posts-item list|class="posts-item card/);
});
@@ -152,12 +152,14 @@ test('multi-column frontend output uses the reference widget wrapper and carries
assert.doesNotMatch(wrapper, /aksrt-widget__inner container|<aside>|<\/aside>/);
const frontend = read('src/WidgetSystem/FrontendRenderer.php');
const routeStart = frontend.indexOf("if (in_array($definition->slug(), ['user_card', 'author_card', 'tab_posts']");
const routeStart = frontend.indexOf("if (in_array($definition->slug(), ['user_card', 'author_card', 'tab_posts', 'posts']");
const contentRouteStart = frontend.indexOf('if (in_array($definition->slug()', routeStart + 1);
const referenceRoute = frontend.slice(routeStart, contentRouteStart);
const contentRoute = frontend.slice(contentRouteStart, frontend.indexOf('private static function render_reference_widget'));
assert.match(referenceRoute, /'user_card', 'author_card', 'tab_posts'/);
assert.doesNotMatch(contentRoute, /'tab_posts'/);
assert.match(referenceRoute, /'user_card', 'author_card', 'tab_posts', 'posts'/);
assert.doesNotMatch(contentRoute, /'tab_posts'|'posts'/);
assert.match(frontend, /\$affix_attr = !empty\(\$instance\['sidebar_affix'\]\) \? ' data-affix="true"'/);
assert.match(frontend, /\. \$affix_attr \. \(\$style/);
});
test('widget list and card CSS is included in the public page bundle at desktop and mobile breakpoints', () => {