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>
100 lines
5.0 KiB
JavaScript
100 lines
5.0 KiB
JavaScript
const test = require('node:test')
|
|
const assert = require('node:assert/strict')
|
|
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
|
|
const root = path.resolve(__dirname, '../..')
|
|
const read = file => fs.readFileSync(path.join(root, file), 'utf8')
|
|
|
|
const app = read('assets/admin/src/App.vue')
|
|
const styles = read('assets/admin/src/style.css')
|
|
const field = read('assets/admin/src/components/form/JioField.vue')
|
|
const fieldGroup = read('assets/admin/src/components/form/JioFieldGroup.vue')
|
|
const formRenderer = read('assets/admin/src/components/form/JioFormRenderer.vue')
|
|
const saveBar = read('assets/admin/src/components/form/JioSaveBar.vue')
|
|
const schemaProvider = read('src/Admin/SchemaProvider.php')
|
|
|
|
test('admin theme exposes the approved white, grey, and green tokens', () => {
|
|
const requiredTokens = {
|
|
'--jio-color-primary': '#18A058',
|
|
'--jio-color-primary-soft': '#EAF7EF',
|
|
'--jio-color-canvas': '#F5F7F6',
|
|
'--jio-color-surface': '#FFFFFF',
|
|
'--jio-color-text': '#1F2923',
|
|
'--jio-color-muted': '#6F7A72',
|
|
'--jio-color-border': '#E2E8E3',
|
|
}
|
|
|
|
for (const [token, value] of Object.entries(requiredTokens)) {
|
|
assert.match(styles, new RegExp(`${token}:\\s*${value}`, 'i'), `missing ${token}`)
|
|
}
|
|
})
|
|
|
|
test('app uses Naive UI overrides and the compact responsive shell', () => {
|
|
assert.match(app, /:theme-overrides="adminThemeOverrides"/)
|
|
assert.match(app, /const adminThemeOverrides = \{/)
|
|
assert.match(app, /:width="232"/)
|
|
assert.match(app, /const MOBILE_BREAKPOINT = 960/)
|
|
assert.match(app, /jio-logo__version/)
|
|
assert.doesNotMatch(app, /jio-csf-(?:shell|header|version)/)
|
|
})
|
|
|
|
test('rejected gradient banner and split-row form overrides do not return', () => {
|
|
const source = `${app}\n${styles}`
|
|
assert.doesNotMatch(source, /#f97794|#623aa2|#0991f5|#0997f5/i)
|
|
assert.doesNotMatch(source, /linear-gradient/i)
|
|
assert.doesNotMatch(styles, /\.jio-field\s*>\s*:not/)
|
|
assert.doesNotMatch(styles, /\.jio-field__label-row\s*\{[^}]*grid-column/s)
|
|
})
|
|
|
|
test('shared forms use card surfaces and design tokens', () => {
|
|
assert.match(fieldGroup, /border:\s*1px solid var\(--jio-color-border\)/)
|
|
assert.match(fieldGroup, /border-radius:\s*12px/)
|
|
assert.match(fieldGroup, /box-shadow:\s*var\(--jio-shadow-card\)/)
|
|
assert.match(field, /color:\s*var\(--jio-color-primary\)/)
|
|
assert.match(field, /background:\s*var\(--jio-color-primary-soft\)/)
|
|
// Sticky save bar is shared by schema pages and custom settings pages.
|
|
assert.match(formRenderer, /<JioSaveBar /)
|
|
assert.match(saveBar, /background:\s*var\(--jio-color-surface\)/)
|
|
})
|
|
|
|
test('navigation, focus, responsive layout, and reduced motion are contracted', () => {
|
|
assert.match(styles, /\.n-menu-item-content--selected::after/)
|
|
assert.match(styles, /:focus-visible/)
|
|
assert.match(styles, /@media \(max-width:\s*960px\)/)
|
|
assert.match(styles, /@media \(max-width:\s*768px\)/)
|
|
assert.match(styles, /@media \(max-width:\s*480px\)/)
|
|
assert.match(styles, /@media \(prefers-reduced-motion:\s*reduce\)/)
|
|
})
|
|
|
|
test('money decimal settings normalize legacy numeric values before validation', () => {
|
|
assert.match(schemaProvider, /private function normalize_money_decimal\(\$value\): string/)
|
|
assert.match(schemaProvider, /if \(is_int\(\$value\)\)/)
|
|
assert.match(schemaProvider, /is_finite\(\$value\)/)
|
|
assert.match(schemaProvider, /AssetAmount::balance\(trim\(\$value\)\)->decimal\(\)/)
|
|
assert.match(schemaProvider, /sanitize_type.*money_decimal[\s\S]*?normalize_money_decimal\(\$data\[\$field\['key'\]\]\)/)
|
|
assert.match(schemaProvider, /sanitize_type.*money_decimal[\s\S]*?normalize_money_decimal\(\$value\)/)
|
|
assert.match(read('assets/admin/src/schema/sections/payment/withdrawal.js'), /affiliate_min_withdrawal: '50\.00'/)
|
|
assert.match(read('assets/admin/src/schema/sections/payment/withdrawal.js'), /affiliate_daily_withdrawal_limit: '500\.00'/)
|
|
})
|
|
|
|
test('captcha scene whitelist matches both admin schemas and excludes dead email verification', () => {
|
|
const captcha = read('inc/modules/captcha.php')
|
|
const phpSchema = read('src/Admin/Schema/SchemaPermissions.php')
|
|
const jsSchema = read('assets/admin/src/schema/sections/permissions/index.js')
|
|
|
|
assert.doesNotMatch(captcha, /'verify_email'\s*=>/)
|
|
assert.doesNotMatch(phpSchema, /'verify_email'/)
|
|
assert.doesNotMatch(jsSchema, /value:\s*'verify_email'/)
|
|
|
|
const sceneBlock = captcha.match(/function jio_captcha_scenes\(\): array \{[\s\S]*?return \[([\s\S]*?)\n\t\];/)
|
|
const phpField = phpSchema.match(/'key' => 'enabled_scenarios'[\s\S]*?'options' => \[([\s\S]*?)\]\],/)
|
|
const jsField = jsSchema.match(/key: 'enabled_scenarios'[\s\S]*?options: \[([\s\S]*?)\n\s*\],/)
|
|
assert.ok(sceneBlock && phpField && jsField, 'captcha scene contracts must be discoverable')
|
|
|
|
const values = (text, pattern) => [...text.matchAll(pattern)].map((match) => match[1]).sort()
|
|
const scenes = values(sceneBlock[1], /'([^']+)'\s*=>/g)
|
|
assert.deepStrictEqual(values(phpField[1], /'value'\s*=>\s*'([^']+)'/g), scenes)
|
|
assert.deepStrictEqual(values(jsField[1], /value:\s*'([^']+)'/g), scenes)
|
|
})
|