进行了一些小优化
This commit is contained in:
@@ -167,3 +167,36 @@ test('retired admin pages, schemas, APIs, and metadata chains are absent', () =>
|
||||
assert.match(read('assets/admin/src/api/modules/tools.js'), /\/settings\/health/);
|
||||
assert.match(read('assets/admin/src/constants/sections/tools.js'), /route: '\/tools\/health'/);
|
||||
});
|
||||
|
||||
test('native user profile omits ledger tables and renders canonical images eagerly', () => {
|
||||
const credits = read('src/User/CreditsAdmin.php');
|
||||
const balance = read('src/User/BalanceAdmin.php');
|
||||
const avatar = read('inc/helpers/aksrt-avatar.php');
|
||||
const level = read('src/User/LevelAdmin.php');
|
||||
|
||||
assert.doesNotMatch(credits, /LedgerQuery::get_instance\(\)->history/);
|
||||
assert.doesNotMatch(credits, /近期%s流水|近期积分流水/);
|
||||
assert.doesNotMatch(balance, /LedgerQuery::get_instance\(\)->history/);
|
||||
assert.doesNotMatch(balance, /近期流水/);
|
||||
assert.match(avatar, /get_avatar\(\$user->ID, 96, '', \$user->display_name, \['loading' => 'eager'\]\)/);
|
||||
assert.doesNotMatch(avatar, /aksrt_get_avatar_html\(\$user->ID, 96/);
|
||||
assert.match(level, /Level::get_level_icon_url\(\$level\)/);
|
||||
assert.match(level, /<img class="aksrt-user-level-icon aksrt-user-level-icon--admin" src="/);
|
||||
assert.doesNotMatch(level, /Level::get_badge_html/);
|
||||
});
|
||||
|
||||
test('identity details and governed status actions are editable on the native profile', () => {
|
||||
const auth = read('src/User/AuthApply.php');
|
||||
const transitions = read('src/Identity/TransitionService.php');
|
||||
|
||||
assert.match(auth, /add_action\('edit_user_profile_update', \[\$this, 'handle_admin_profile_update'\]\)/);
|
||||
assert.match(auth, /current_user_can\('aksrt_review_identity'\)/);
|
||||
assert.match(auth, /wp_nonce_field\('aksrt_identity_profile_' \.[\s\S]*?'aksrt_identity_profile_nonce'\)/);
|
||||
assert.match(auth, /name="aksrt_identity_application_uuid"/);
|
||||
assert.match(auth, /name="aksrt_identity_public_name"/);
|
||||
assert.match(auth, /name="aksrt_identity_public_desc"/);
|
||||
assert.match(auth, /name="aksrt_identity_action"/);
|
||||
assert.match(auth, /TransitionService::allowed_targets/);
|
||||
assert.match(auth, /self::review\(\$user_id, \$application_uuid, \$action, \$note, get_current_user_id\(\), \$fields\)/);
|
||||
assert.match(transitions, /public static function allowed_targets/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user