Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
92 lines
4.3 KiB
JavaScript
92 lines
4.3 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const root = path.resolve(__dirname, '..', '..');
|
|
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8');
|
|
|
|
test('featured box shows only the icon image/video buttons and no slide button', () => {
|
|
const featured = read('templates/parts/submit/featured.php');
|
|
|
|
// Like the reference theme, the image button also serves slide covers via
|
|
// multi-select, so it renders whenever either capability is granted.
|
|
assert.match(
|
|
featured,
|
|
/if \(\$can_image \|\| \$can_slide\) : \?>\s*\n\s*<button type="button" class="but btn-image" data-featured-action="image"\s*\n\s*title="<\?php esc_attr_e\('图片', 'jio'\); \?>"\s*\n\s*aria-label="<\?php esc_attr_e\('图片', 'jio'\); \?>">\s*\n\s*<i class="fa fas fa-image"><\/i>\s*\n\s*<\/button>/
|
|
);
|
|
|
|
// The dedicated slide button is gone; slide covers come from multi-select.
|
|
assert.doesNotMatch(featured, /btn-slide|data-featured-action="slide"|幻灯片/);
|
|
});
|
|
|
|
test('image picker folds multi-select into a slide cover like the reference theme', () => {
|
|
const js = read('assets/js/front-submit.js');
|
|
|
|
assert.match(js, /featuredOptions = \(args && args\.options\) \|\| \{\};/);
|
|
assert.match(js, /var slideEnabled = !!coverOptions\.slide;/);
|
|
assert.match(js, /var imageAllowed = !!coverOptions\.image;/);
|
|
assert.match(js, /multiple: slideEnabled,/);
|
|
assert.match(js, /maxItems: slideEnabled \? 30 : 1,/);
|
|
assert.match(js, /slides\.length > 1 \|\| \(slideEnabled && !imageAllowed\)/);
|
|
assert.match(js, /self\.setFeatured\('slide', slides\)/);
|
|
assert.match(js, /self\.setFeatured\('image', slides\[0\]\)/);
|
|
|
|
// The standalone slide action died with its button.
|
|
assert.doesNotMatch(js, /act === 'slide'/);
|
|
});
|
|
|
|
test('slide cover preview renders a real swiper like the reference theme', () => {
|
|
const featured = read('templates/parts/submit/featured.php');
|
|
const js = read('assets/js/front-submit.js');
|
|
|
|
const swiperContract =
|
|
/new-swiper scale-height" data-loop="true" data-autoplay="true" data-interval="2000" style="--scale-height:50%;"/;
|
|
assert.match(featured, swiperContract);
|
|
assert.match(js, swiperContract);
|
|
|
|
// Server-rendered slides iterate the saved attachment list.
|
|
assert.match(featured, /foreach \(\$data as \$slide\) : \?>/);
|
|
assert.match(featured, /<div class="swiper-slide"><img src="<\?php echo esc_url\(\(string\) \$slide\['url'\]\); \?>"/);
|
|
|
|
// Client-rendered slides come from the multi-select payload; the runtime
|
|
// initializer (auto_fun -> new_swiper) must run for slide covers too.
|
|
assert.match(js, /'<div class="swiper-slide"><img src="' \+ escapeHtml\(item\.url\) \+ '" alt=""><\/div>'/);
|
|
assert.match(js, /t === 'video' \|\| t === 'slide'/);
|
|
|
|
for (const control of ['swiper-wrapper', 'swiper-button-prev', 'swiper-button-next', 'swiper-pagination']) {
|
|
assert.match(featured, new RegExp(`class="${control}"`));
|
|
assert.match(js, new RegExp(`class="${control}"`));
|
|
}
|
|
|
|
// The static first-image slide preview is gone.
|
|
assert.doesNotMatch(js, /escapeHtml\(d\[0\]\.url\)/);
|
|
});
|
|
|
|
test('featured previews carry no type badge like the reference theme', () => {
|
|
const featured = read('templates/parts/submit/featured.php');
|
|
const js = read('assets/js/front-submit.js');
|
|
const css = read('assets/css/frontend/pages/submit.css');
|
|
|
|
assert.doesNotMatch(featured, /featured-type-badge/);
|
|
assert.doesNotMatch(js, /featured-type-badge/);
|
|
assert.doesNotMatch(css, /featured-type-badge/);
|
|
});
|
|
|
|
test('submit.css mirrors the reference visibility matrix for the buttons row', () => {
|
|
const css = read('assets/css/frontend/pages/submit.css');
|
|
|
|
assert.match(
|
|
css,
|
|
/\.featured-edit \.btns-full \.btn-image,\s*\n\.featured-edit \.btns-full \.btn-video,\s*\n\.featured-edit \.btns-full \.btn-delete:not\(\[hidden\]\) \{\s*\n display: inline-flex;/
|
|
);
|
|
assert.match(css, /\.featured-edit \.btns-full \.btn-image > \.fa,[\s\S]*?\.featured-edit \.btns-full \.btn-delete > \.fa \{\s*\n margin-right: 0;\s*\n\}/);
|
|
assert.match(
|
|
css,
|
|
/\.featured-loaded\.image \.btn-video,\s*\n\.featured-loaded\.slide \.btn-video,\s*\n\.featured-loaded\.video \.btn-image \{\s*\n display: none;\s*\n\}/
|
|
);
|
|
assert.doesNotMatch(css, /btn-slide/);
|
|
});
|