From 9e6ee55de9d42d030e7a96eaf34ec6f26680f645 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 2 Sep 2026 21:49:41 +0800 Subject: [PATCH] =?UTF-8?q?test(navigation):=20=E5=A5=91=E7=BA=A6=E6=96=AD?= =?UTF-8?q?=E8=A8=80=E5=AF=B9=E9=BD=90=E6=89=93=E5=8C=85=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=97=B6=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 依赖图测试:jquery deregister/单文件注册断言改为断言 jquery-core 收敛、 aksrt-runtime 指向 public.js,以及打包工具纳入 bootstrap/fontawesome5/ main.min.css/loader/main.min - header DOM 测试:移除已废弃的 nav_user_newposts_btn 与 navbar-but 断言, 改断言 navbar-newposts 与 header-userbox.css 进入 public.css 打包清单 --- .../legacy-navigation-contract.test.cjs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/tests/navigation/legacy-navigation-contract.test.cjs b/tests/navigation/legacy-navigation-contract.test.cjs index 44b8811e..1d8e4661 100644 --- a/tests/navigation/legacy-navigation-contract.test.cjs +++ b/tests/navigation/legacy-navigation-contract.test.cjs @@ -38,13 +38,19 @@ const header = join([ ]); test('the public dependency graph is the single local runtime stack', () => { - assert.match(scripts, /wp_deregister_script\('jquery'\)/); - assert.match(scripts, /jquery\.min\.js'[\s\S]*?'1\.9\.1'/); - assert.match(scripts, /bootstrap\.min\.css'[\s\S]*?'3\.4\.1'/); - assert.match(scripts, /fontawesome5'[\s\S]*?all\.min\.css'[\s\S]*?'5\.15\.4'/); - assert.match(scripts, /main\.min\.css/); - assert.match(scripts, /loader\.js'[\s\S]*?\['jquery', 'bootstrap'\]/); - assert.match(read('assets/js/runtime/loader.js'), /tbquire\(\['main'\]\)/); + const buildTool = read('tools/build-public-assets.mjs'); + + assert.match(scripts, /registered\['jquery'\]->deps = \['jquery-core'\]/); + assert.match(scripts, /wp_enqueue_script\('jquery'\)/); + assert.doesNotMatch(scripts, /wp_deregister_script\('jquery'\)/); + assert.match(scripts, /'aksrt-runtime'/); + assert.match(scripts, /assets\/js\/build\/public\.js/); + assert.match(buildTool, /assets\/css\/bootstrap\.min\.css/); + assert.match(buildTool, /assets\/fontawesome5\/css\/all\.min\.css/); + assert.match(buildTool, /assets\/css\/main\.min\.css/); + assert.match(buildTool, /assets\/js\/runtime\/libs\/bootstrap\.min\.js/); + assert.match(buildTool, /assets\/js\/runtime\/loader\.js/); + assert.match(buildTool, /assets\/js\/runtime\/main\.min\.js/); for (const file of [ 'assets/js/runtime/libs/jquery.min.js', 'assets/js/runtime/libs/bootstrap.min.js', @@ -146,16 +152,17 @@ test('mobile navigation is one setting-driven left right or top drawer', () => { test('guest account member VIP and publish contracts share reference header DOM', () => { const userboxCss = read('assets/css/frontend/header-userbox.css'); + const buildTool = read('tools/build-public-assets.mjs'); assert.match(header, /is_user_logged_in\(\)/); assert.match(header, /sub-user-box aksrt-header-userbox/); assert.match(header, /signin-loader|signin/); assert.match(header, /get_payment_vip_settings/); - assert.match(header, /nav_user_newposts_btn/); + assert.match(header, /navbar-newposts/); assert.match(header, /nav_newposts/); - assert.match(header, /navbar-form navbar-right navbar-but/); + assert.match(header, /navbar-form navbar-right/); assert.match(header, /pay-vip/); - assert.match(scripts, /\$enqueue_module\('header-userbox'\)/); + assert.match(buildTool, /assets\/css\/frontend\/header-userbox\.css/); assert.match(userboxCss, /\.aksrt-header-userbox \.user-info > \.avatar/); assert.match(userboxCss, /\.aksrt-header-wallet/); assert.match(userboxCss, /\.aksrt-header-checkin/);