进行了一些小修复

This commit is contained in:
2026-08-26 12:10:06 +08:00
parent 90b3ccb006
commit dc14c29878
15 changed files with 11720 additions and 4354 deletions
@@ -22,7 +22,7 @@ test('modal and sign page use one renderer and one state machine', () => {
assert.match(shared, /data-auth-panel="bind"/);
assert.match(shared, /data-auth-panel="oauth"/);
assert.match(scripts, /assets\/js\/auth\.js/);
assert.match(scripts, /'aksrt-notyf', 'aksrt-runtime'/);
assert.match(scripts, /'aksrt-auth',[\s\S]*?assets\/js\/auth\.js[\s\S]*?\['aksrt-runtime'\]/);
assert.doesNotMatch(scripts, /modal-auth\.js|sign-register\.js/);
assert.doesNotMatch(runtime, /signsubmit-loader|tbquire\(\['sign-register'\]\)|\.on\('click', '\.(?:signin|signup)-loader'/);
assert.doesNotMatch(loader, /sign-register/);
@@ -126,18 +126,20 @@ test('the legacy runtime owns lazySizes while AKSRT consumers share one image-at
const bridge = read('assets/js/lazy-image-attr.js');
const scripts = read('src/Core/ScriptsPart1c.php');
const routeScripts = read('src/Core/ScriptsPart1b.php');
const builder = read('tools/build-public-assets.mjs');
const pagination = read('assets/js/core/pagination.js');
const widgets = read('assets/widgets/frontend.js');
assert.match(runtime, /window\.lazySizes = lazySizes/);
assert.match(bridge, /window\.aksrtGetLazyImageAttr = function/);
assert.match(scripts, /'aksrt-lazy-image-attr'/);
assert.match(scripts, /'aksrt-rehydrate'[\s\S]*?\['loader_js', 'aksrt-lazy-image-attr'\]/);
assert.match(builder, /assets\/js\/lazy-image-attr\.js/);
assert.match(builder, /assets\/js\/rehydrate\.js/);
assert.match(scripts, /assets\/js\/build\/public\.js'[\s\S]*?\['loader_js'\]/);
for (const file of ['pay-vip.js', 'order-center.js', 'page-navs.js', 'credits.js']) {
const blocks = enqueueBlocksFor(routeScripts, file);
assert.ok(blocks.length > 0, `${file} must be enqueued`);
for (const block of blocks) {
assert.match(block, /aksrt-lazy-image-attr/, `${file} must depend on the image-attribute bridge`);
assert.match(block, /aksrt-runtime/, `${file} must depend on the bundled image-attribute bridge`);
}
}
assert.match(runtime, /lazybeforeunveil/);
@@ -277,7 +277,7 @@ test('AJAX pagination can recover, caps auto loading and rehydrates appended med
assert.match(media, /window\.Grade\(container/);
assert.match(media, /linear-gradient\(135deg/);
assert.match(media, /aksrtGradientState/);
assert.match(read('src/Core/ScriptsPart1c.php'), /'aksrt-grade'/);
assert.match(read('tools/build-public-assets.mjs'), /assets\/js\/grade\.min\.js/);
});
test('the pinned visual baseline records all source checksums', () => {
+10 -9
View File
@@ -173,6 +173,7 @@ test('clicking a notification uses the legacy exit class and removal delay', ()
test('notyf CSS and WordPress enqueue match the reference contract', () => {
const css = read('assets/css/frontend/notyf.css');
const scripts = read('src/Core/ScriptsPart1c.php');
const builder = read('tools/build-public-assets.mjs');
assert.match(css, /\.notyn\s*\{[\s\S]*?bottom:\s*6em;[\s\S]*?max-width:\s*320px;[\s\S]*?z-index:\s*10000000;/);
assert.match(css, /\.notyf\s*\{[\s\S]*?position:\s*relative;[\s\S]*?font-size:\s*14px;[\s\S]*?line-height:\s*1\.42857143;[\s\S]*?min-width:\s*200px;[\s\S]*?padding:\s*1em 3em 1em 3\.4em;/);
@@ -188,9 +189,9 @@ test('notyf CSS and WordPress enqueue match the reference contract', () => {
assert.match(css, /content:\s*'\\f057'/);
assert.match(css, /\.notyf\.load::before[\s\S]*?huan-rotate 1s/);
assert.match(scripts, /'aksrt-notyf',[\s\S]*?'\/assets\/js\/notyf\.js',[\s\S]*?\['jquery'\]/);
assert.match(scripts, /'aksrt-runtime',[\s\S]*?\['aksrt-rehydrate', 'aksrt-notyf'\]/);
assert.match(scripts, /'\/assets\/css\/frontend\/notyf\.css',[\s\S]*?'_fontawesome'/);
assert.match(builder, /assets\/js\/notyf\.js/);
assert.match(builder, /assets\/css\/frontend\/notyf\.css/);
assert.match(scripts, /'aksrt-runtime',[\s\S]*?'\/assets\/js\/build\/public\.js',[\s\S]*?\['loader_js'\]/);
});
test('balance center actions use direct fixed-id notyf flows', () => {
@@ -242,8 +243,8 @@ test('balance center actions use direct fixed-id notyf flows', () => {
assert.doesNotMatch(credits, /function initSignin\(|\/signin\/today|POST \/signin/);
assert.match(signinController, /aksrtSigninInitialized/);
assert.match(credits, /aksrtPointsExchangeInitialized[\s\S]*?aksrtWithdrawInitialized/);
assert.match(scripts, /'aksrt-credits',[\s\S]*?\/assets\/js\/credits\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
assert.match(scripts, /\$signin_on\s*=\s*is_user_logged_in\(\)[\s\S]*?'aksrt-signin',[\s\S]*?\/assets\/js\/signin\.js',[\s\S]*?'aksrt-core-request'[\s\S]*?'aksrt-notyf'/);
assert.match(scripts, /'aksrt-credits',[\s\S]*?\/assets\/js\/credits\.js',[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\]/);
assert.match(scripts, /\$signin_on\s*=\s*is_user_logged_in\(\)[\s\S]*?'aksrt-signin',[\s\S]*?\/assets\/js\/signin\.js',[\s\S]*?'aksrt-runtime'/);
assert.ok(header.indexOf('data-signin-btn') < header.indexOf('uc-header__message-btn'));
assert.match(header, /uc-header__message-btn[^>]+aria-label="<\?php esc_attr_e\('消息通知'/);
assert.doesNotMatch(header, /<i class="fa fas fa-bell"[^>]*><\/i>\s*<\?php esc_html_e\('消息通知'/);
@@ -282,7 +283,7 @@ test('VIP purchase and points exchange use direct fixed-id notyf flows', () => {
assert.doesNotMatch(vip, /setTip|aksrt-vip-modal-tip/);
assert.doesNotMatch(css, /\.aksrt-vip-modal-tip/);
assert.match(scripts, /'aksrt-pay-vip',[\s\S]*?\/assets\/js\/pay-vip\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
assert.match(scripts, /'aksrt-pay-vip',[\s\S]*?\/assets\/js\/pay-vip\.js',[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\]/);
});
test('payment entry points never load the removed legacy pay runtime', () => {
@@ -324,7 +325,7 @@ test('profile save uses AJAX rehydrate and a fixed-id notyf flow without query f
assert.match(profile, /notyf\([^;]+?'success'[^;]+?'aksrt-profile-save-toast'\);/);
assert.match(profile, /notyf\([^;]+?'danger'[^;]+?'aksrt-profile-save-toast'\);/);
assert.match(profile, /fetch\(ajaxUrl, \{ method: 'POST', credentials: 'same-origin', body: data \}\)/);
assert.match(scripts, /\$user_center_deps[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\][\s\S]*?\/assets\/js\/routes\/user-center\.js/);
assert.match(scripts, /\$user_center_deps[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\][\s\S]*?\/assets\/js\/routes\/user-center\.js/);
assert.doesNotMatch(page, /REQUEST_METHOD|profile_error|['"]saved['"]|add_query_arg/);
assert.doesNotMatch([profile, form, layout, lists].join('\n'), /profile-save-msg|profile-form__submit-msg/);
@@ -401,7 +402,7 @@ test('front submit actions use direct fixed-id notyf flows', () => {
assert.match(submit, /needContent[^;]+?'warning'/);
assert.doesNotMatch(submit, /\b(?:window\.)?alert\s*\(/);
assert.match(page, /'aksrt-front-submit',[\s\S]*?'\/assets\/js\/front-submit\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
assert.match(page, /'aksrt-front-submit',[\s\S]*?'\/assets\/js\/front-submit\.js',[\s\S]*?\[[^\]]*'aksrt-runtime'[^\]]*\]/);
});
test('legacy frontend toast APIs and selectors are fully removed', () => {
@@ -409,7 +410,7 @@ test('legacy frontend toast APIs and selectors are fully removed', () => {
'assets/js',
'assets/css/frontend',
'assets/css/routes',
'assets/css/build/frontend-base.min.css.disabled',
'assets/css/build',
'page.php',
'templates/pages/page-profile.php',
];