fix 更多栏目

This commit is contained in:
2026-09-05 17:32:18 +08:00
parent 5b89fc200b
commit 05a6b6fc54
28 changed files with 440 additions and 2295 deletions
@@ -112,15 +112,50 @@ test('user center navigation initializes once across auto_fun rescans', () => {
assert.doesNotMatch(source, /name === 'vip' && !forceLoad\) forceLoad = true/);
});
test('homepage sort refreshes one DOM panel without URL state', () => {
const source = read('assets/js/homepage-fixed.js')
test('homepage tabs refresh the original pane DOM through the runtime post_ajax pipeline', () => {
const layout = read('inc/helpers/homepage/layout.php')
const homepage = read('inc/helpers/aksrt-homepage.php')
const controller = read('src/Admin/GlobalController.php')
assert.match(source, /event\.preventDefault\(\)/)
assert.match(source, /requestHomepagePanel\(activePanel, \{/)
assert.doesNotMatch(source, /home_sort|replaceState|location\.search|data-sort-ajax|homepageSortAjax/)
assert.doesNotMatch(homepage, /home_sort|data-sort-ajax|add_query_arg\(['"]home_sort['"]|homepage_sort_ajax_enabled/)
assert.doesNotMatch(controller, /'page_url'\s*=>|'source'\s*=>/)
// legacy zib_index_tab_html 契约:data-toggle="tab" + data-ajax 栏目链接。
assert.match(layout, /<a data-toggle="tab" data-ajax="/)
assert.match(layout, /href="#index-tab-main"/)
assert.match(layout, /class="index-tab affix-header-sm relative home-tab-nav-box mb10" offset-top="-8"/)
// pane 本身是原位刷新容器:zib_index_tab('content') 契约。
assert.match(layout, /class="posts-row ajaxpager tab-pane fade in active" id="index-tab-main"/)
assert.match(layout, /class="ajaxpager tab-pane fade" id="index-tab-/)
assert.match(layout, /<span class="post_ajax_trigger"><a class="ajax_load ajax-next ajax-open" href="/)
assert.match(layout, /<div class="post_ajax_loader">/)
// nofilter:栏目页响应不再输出筛选菜单,避免 win-ajax-replace 串页。
assert.match(layout, /'nofilter' => 'true'/)
// 不再有旁路刷新:REST 面板、骨架屏、面板 footer 全部移除。
assert.equal(fs.existsSync(path.join(root, 'assets/js/homepage-fixed.js')), false)
assert.doesNotMatch(layout, /data-home-tab-panel|aksrt-homepage__panel|aksrt-homepage__tab|requestHomepagePanel|data-sticky-tabs/)
assert.doesNotMatch(controller, /homepage\/tab-posts|rest_homepage_tab_posts/)
// 排序菜单 = zib_ajax_option_menu('home') 契约:win-ajax-replace="filter" + ajax-next 链接。
assert.match(homepage, /function aksrt_homepage_render_ajax_option_menu/)
assert.match(homepage, /win-ajax-replace="filter"/)
assert.match(homepage, /ajax-replace="true" class="' \. esc_attr\(\$_class\)/)
assert.match(homepage, /!empty\(\$_GET\['nofilter'\]\)/)
// 主查询吃 ?orderby=(legacy zib_sift_posts_per_orde),排序原位刷新才有效。
assert.match(homepage, /function aksrt_homepage_get_request_sort/)
assert.match(read('inc/helpers/homepage/content.php'), /aksrt_homepage_get_request_sort\(\)/)
// runtime 是 tab/排序的唯一引擎。
const runtime = read('assets/js/runtime/main.js')
assert.match(runtime, /_win\.bd\.on\('show\.bs\.tab', 'a\[data-ajax\]'/)
assert.match(runtime, /function post_ajax\(/)
// ajax-list.js 让出 runtime 管辖的控件,避免双请求。
assert.match(read('assets/js/core/ajax-list.js'), /link\.closest\("\.ajax-option, \.post_ajax_trigger"\)/)
})
test('archive streams nest pagination inside the ajaxpager for tab extraction', () => {
const archive = read('inc/helpers/aksrt-archive.php')
assert.match(archive, /append_inner_html/)
assert.doesNotMatch(archive, /content-stream__footer/)
assert.match(read('inc/helpers/posts-renderer/markup.php'), /append_inner_html/)
assert.doesNotMatch(read('assets/js/core/pagination.js'), /data-home-tab-panel|content-stream__footer/)
})
test('HTML fragment injection announces post_ajax before auto_fun', () => {
for (const file of ['assets/js/core/pagination.js', 'assets/js/author.js', 'assets/js/credits.js', 'assets/js/routes/user-center.js']) {