进行了一些小修复

This commit is contained in:
2026-08-26 12:35:20 +08:00
parent dc14c29878
commit 065a5bc99c
16 changed files with 3655 additions and 2508 deletions
@@ -127,6 +127,8 @@ test('the legacy runtime owns lazySizes while AKSRT consumers share one image-at
const scripts = read('src/Core/ScriptsPart1c.php');
const routeScripts = read('src/Core/ScriptsPart1b.php');
const builder = read('tools/build-public-assets.mjs');
const loader = read('assets/js/runtime/loader.js');
const searchShell = read('inc/helpers/header/aksrt-header-menu-search.php');
const pagination = read('assets/js/core/pagination.js');
const widgets = read('assets/widgets/frontend.js');
@@ -134,7 +136,9 @@ test('the legacy runtime owns lazySizes while AKSRT consumers share one image-at
assert.match(bridge, /window\.aksrtGetLazyImageAttr = function/);
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'\]/);
assert.match(builder, /assets\/js\/runtime\/main\.min\.js/);
assert.doesNotMatch(loader, /['"]main['"]\s*:|tbquire\(\[['"]main['"]\]\)/);
assert.match(scripts, /assets\/js\/build\/public\.js'[\s\S]*?\['jquery'\]/);
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`);
@@ -147,6 +151,10 @@ test('the legacy runtime owns lazySizes while AKSRT consumers share one image-at
assert.match(runtime, /var bg = _this\.attr\('data-bg'\)[\s\S]*?background-image/);
assert.match(runtime, /var lazyload_action = _this\.attr\('lazyload-action'\)/);
assert.match(runtime, /if \(_this\.attr\('remote-box'\)\)[\s\S]*?_this\.click\(\)/);
assert.match(searchShell, /'type'\s*=>\s*'click'/);
assert.match(runtime, /aksrt:remote-loaded/);
assert.doesNotMatch(runtime, /action:\s*'get_current_user'/);
assert.match(runtime, /var cases = jQuery\('\.vanilla-tilt:not\(\.is-initialized\)'\);[\s\S]*?if \(!cases\.length\)[\s\S]*?tbquire\(\['tilt'\]/);
assert.doesNotMatch(pagination, /IntersectionObserver|new Image\(/);
assert.doesNotMatch(widgets, /IntersectionObserver/);
});
@@ -280,6 +280,12 @@ test('AJAX pagination can recover, caps auto loading and rehydrates appended med
assert.match(read('tools/build-public-assets.mjs'), /assets\/js\/grade\.min\.js/);
});
test('front-end carousel CSS is conditional on carousel block content', () => {
const hooks = read('inc/core-hooks/part-3.php');
assert.match(hooks, /has_block\('aksrt\/carousel', \$post\)/);
assert.match(hooks, /if \(!\$has_carousel\) return;[\s\S]*?'aksrt-gutenberg-blocks-front'/);
});
test('the pinned visual baseline records all source checksums', () => {
const baseline = JSON.parse(read('tests/visual/zibll-9.0-article-baseline.json'));
assert.equal(baseline.theme, 'Zibll');
+3 -2
View File
@@ -191,7 +191,8 @@ test('notyf CSS and WordPress enqueue match the reference contract', () => {
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'\]/);
assert.match(builder, /assets\/js\/runtime\/loader\.js/);
assert.match(scripts, /'aksrt-runtime',[\s\S]*?'\/assets\/js\/build\/public\.js',[\s\S]*?\['jquery'\]/);
});
test('balance center actions use direct fixed-id notyf flows', () => {
@@ -306,7 +307,7 @@ test('payment entry points never load the removed legacy pay runtime', () => {
assert.match(content, /data-aksrt-pay-content/);
assert.match(scripts, /'aksrt-pay-vip'/);
assert.match(scripts, /'aksrt-cms-download'/);
assert.match(scripts, /\$runtime_loader_version = file_exists\(\$runtime_loader_path\)/);
assert.match(scripts, /\$public_runtime_path = get_template_directory\(\) \. '\/assets\/js\/build\/public\.js'/);
assert.match(scripts, /\$runtime_version = file_exists\(\$runtime_main_path\)/);
assert.match(scripts, /'ver'\s*=> \$runtime_version/);
});