fix(frontend): remove residual post thumbnail lazy path

This commit is contained in:
2026-08-18 01:52:00 +08:00
parent 435ee1daa7
commit fb11a7ed0c
8 changed files with 27 additions and 15 deletions
@@ -119,6 +119,23 @@ test('one lazySizes runtime owns dynamic media, backgrounds, videos, and IAS', (
assert.doesNotMatch(widgets, /IntersectionObserver/);
});
test('post lists have no second lazy switch and keep Zibll fallback thumbnails', () => {
const config = read('inc/helpers/posts-renderer/config.php');
const postData = read('inc/helpers/posts-renderer/post-data.php');
const markup = read('inc/helpers/posts-renderer/markup.php');
const phpSchema = read('src/Admin/Schema/SchemaPostList.php');
const vueSchema = read('assets/admin/src/schema/sections/post-list/thumb.js');
const legacyKey = 'thumb_' + 'lazy';
for (const source of [config, postData, markup, phpSchema, vueSchema]) {
assert.equal(source.includes(legacyKey), false);
}
assert.match(postData, /aksrt_get_lazy_attr\('lazy_posts_thumb', \$img, \$fit_class\)/);
assert.match(markup, /aksrt_get_lazy_attr\('lazy_posts_thumb', \(string\) \$data\['img_url'\], \$fit_class\)/);
assert.match(config, /\$fallback\s*=\s*sanitize_key[\s\S]*?\$fallback\s*===\s*'placeholder'[\s\S]*?aksrt_get_lazy_thumb\(\)/);
assert.doesNotMatch(config, /rand_thumb/);
});
test('legacy lazy identifiers and theme-native loading attributes are gone', () => {
const files = sourceFiles(root).filter((file) => !file.endsWith('lazyload-contract.test.cjs'));
const source = files.map((file) => fs.readFileSync(file, 'utf8')).join('\n');
@@ -128,6 +145,7 @@ test('legacy lazy identifiers and theme-native loading attributes are gone', ()
'get_' + 'lazyload_config',
'aksrt_' + 'lazy_img_attrs',
'aksrt_' + 'lazy_loading',
'thumb_' + 'lazy',
];
for (const token of forbidden) assert.equal(source.includes(token), false, token);
assert.doesNotMatch(source, /aksrt-lazy(?!sizes)/);