Files
wordpress-theme-aksrt/tests/widget-system/user-card-runtime-contract.test.cjs
T
kate522andClaude Opus 5 35bb96e82f refactor: rename the theme brand and every identifier from AKSRT to Jio
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>
2026-11-01 20:05:04 +08:00

55 lines
3.0 KiB
JavaScript

'use strict'
const assert = require('node:assert/strict')
const path = require('node:path')
const { spawnSync } = require('node:child_process')
const test = require('node:test')
const root = path.resolve(__dirname, '../..')
test('user and author widgets render the reference state contract', () => {
const result = spawnSync(process.env.PHP_BINARY || 'php', [path.join(__dirname, 'user-card-runtime-harness.php')], {
cwd: root,
encoding: 'utf8',
})
assert.equal(result.status, 0, result.stderr || result.stdout)
const data = JSON.parse(result.stdout)
assert.match(data.guest, /^<div class="mb20"><div class="user-card zib-widget widget">/)
assert.match(data.guest, /data-lazy-type="lazy_other"/)
assert.match(data.guest, /alt="默认头像"/)
assert.match(data.guest, /<div class="user-info mt10"><div class="text-center"><p class="muted-color box-body em12">/)
assert.match(data.guest, /signin-loader but jb-blue padding-lg/)
assert.match(data.guest, /signup-loader ml10 but jb-yellow padding-lg/)
assert.match(data.guest, /social-separator separator muted-3-color em09 mt20 mb20/)
assert.match(data.guest, /social_loginbar/)
assert.match(data.guest, /class="social-login-item github toggle-radius"/)
assert.match(data.guest, /class="social-login-item qq toggle-radius" data-provider="clogin_qq"/)
assert.match(data.guest, /title="GitHub登录"/)
assert.doesNotMatch(data.guest, /jio-widget|jio-panel-wrap|user-card__auth-btns|oauth-row|oauth-btn/)
// The social-login area carries no agreement copy; the reference guest card
// only shows the separator, the .social_loginbar and the provider buttons.
assert.doesNotMatch(data.guest, /我已阅读并同意|使用社交账号登录即表示|注册即表示/)
assert.match(data.guest_no_registration, /signin-loader but jb-blue padding-lg/)
assert.doesNotMatch(data.guest_no_registration, /signup-loader/)
assert.equal(data.closed, '')
assert.match(data.logged, /^<div class="mb20"><div class="user-card zib-widget widget">/)
assert.match(data.logged, /data-lazy-type="lazy_cover"/)
assert.match(data.logged, /<div class="card-content mt10 relative">/)
assert.match(data.logged, /<div class="user-name flex jc">/)
assert.match(data.logged, /<div class="author-tag mt10 mini-scrollbar">/)
assert.match(data.logged, /<div class="user-desc mt10 muted-2-color em09">/)
assert.doesNotMatch(data.logged, /data-post-type=/)
assert.match(data.logged_buttons, /class="newadd-btns but pw-1em mr6 jb-pink" href="https:\/\/example\.test\/new-post">发布文章<\/a>/)
assert.match(data.logged_buttons, /rel="nofollow" href="https:\/\/example\.test\/user-center" class="but pw-1em ml6 jb-blue">用户中心<\/a>/)
assert.doesNotMatch(data.logged_buttons, /<icon|<text>/)
assert.match(data.author, /^<div class="mb20"><div class="user-card zib-widget widget">/)
assert.match(data.author, /data-lazy-type="lazy_cover"/)
assert.match(data.author, /data-post-type="post" data-post-style="card"/)
assert.doesNotMatch(data.author, /user-btns mt20/)
})