fix(theme): align reference layouts and restore passing contracts
Align homepage and category discovery, modern widgets, admin controls, quotes, and comments with the reference theme. Remove superseded paths and add rendering and behavior coverage. Update stale asset and finance contracts; all 760 Node tests and 139 widget assertions pass.
This commit is contained in:
1 parent
b520d29368
commit
8aa116ec43
63 files changed
+1985
-2304
No files matched your search
@@ -14,6 +14,7 @@ test('QR generator is bundled locally; no external QR CDN in front-end sources',
|
||||
// 前端引用面不允许出现外部二维码 CDN。
|
||||
const sources = [
|
||||
read('assets', 'js', 'credits.js'),
|
||||
read('assets', 'js', 'credits-affiliate.js'),
|
||||
read('inc', 'helpers', 'user-center-renderers', 'profile-revenue.php'),
|
||||
read('src', 'Core', 'ScriptsPart1b.php'),
|
||||
].join('\n')
|
||||
@@ -53,7 +54,7 @@ test('revenue detail card is a four-row info list with no standalone QR block',
|
||||
// 返佣详解标题走可配置字段,不再硬编码。
|
||||
assert.match(template, /esc_html\(\$details_title\)/)
|
||||
|
||||
const script = read('assets', 'js', 'credits.js')
|
||||
const script = read('assets', 'js', 'credits-affiliate.js')
|
||||
// 独立二维码绘制函数已删除;window.qrcode 仅供海报使用。
|
||||
assert.doesNotMatch(script, /function renderAffiliateQr/)
|
||||
assert.doesNotMatch(script, /renderAffiliateQr\(/)
|
||||
@@ -111,7 +112,7 @@ test('poster canvas is built from admin-configured copy and gated on the poster
|
||||
assert.match(attribution, /'referrer_name' => \$user instanceof WP_User \? \$user->display_name/)
|
||||
assert.match(attribution, /'site_name' => get_bloginfo\('name'\)/)
|
||||
|
||||
const script = read('assets', 'js', 'credits.js')
|
||||
const script = read('assets', 'js', 'credits-affiliate.js')
|
||||
// 海报仅在开关开启时暴露按钮;推荐人昵称也由 REST 下发。
|
||||
assert.match(script, /initAffiliatePoster\(root, url \|\| j\.url \|\| '', j\.poster \|\| \{\}, j\.site_name \|\| document\.title, j\.referrer_name \|\| ''\)/)
|
||||
assert.match(script, /poster\.enabled !== true\) return/)
|
||||
@@ -136,7 +137,7 @@ test('poster canvas is built from admin-configured copy and gated on the poster
|
||||
})
|
||||
|
||||
test('poster canvas layers match the reference rebate branch 1:1', () => {
|
||||
const script = read('assets', 'js', 'credits.js')
|
||||
const script = read('assets', 'js', 'credits-affiliate.js')
|
||||
const body = script.slice(script.indexOf('function buildPosterCanvas'), script.indexOf('// cover 裁切'))
|
||||
|
||||
// 参考主题 rebate 分支用 drawTextOverflow 的换行/截断,不是自研 wrapText。
|
||||
@@ -196,7 +197,7 @@ test('poster modal markup is a 1:1 replica of the reference poster-share dialog'
|
||||
|
||||
test('poster modal shell is hidden at rest so it cannot block the whole page', () => {
|
||||
const modal = read('inc', 'helpers', 'user-center-renderers', 'affiliate-poster-modal.php')
|
||||
const script = read('assets', 'js', 'credits.js')
|
||||
const script = read('assets', 'js', 'credits-affiliate.js')
|
||||
const css = read('assets', 'css', 'routes', 'user-center', 'credits.css')
|
||||
|
||||
// 标记、JS 查询与 CSS 钩子必须共用同一个属性,缺一即失效:
|
||||
@@ -229,12 +230,15 @@ test('invite-code input verifies live against the public REST endpoint', () => {
|
||||
assert.match(script, /\/wp-json\/aksrt\/v1\/invite-code\/verify\?code=/)
|
||||
})
|
||||
|
||||
test('qrcode asset is enqueued only for profile + affiliate and credits depends on it', () => {
|
||||
test('affiliate posters declare the local QR dependency independently of withdrawal history', () => {
|
||||
const scripts = read('src', 'Core', 'ScriptsPart1b.php')
|
||||
assert.match(scripts, /assets\/js\/vendor\/qrcode\.min\.js/)
|
||||
assert.match(scripts, /'aksrt-qrcode'/)
|
||||
// credits.js 的依赖数组必须在 enqueue 调用内合并 QR 库句柄。
|
||||
assert.match(scripts, /array_merge\(\['loader_js', 'aksrt-vip-coordinator'\], \$affiliate_deps\)/)
|
||||
// 海报模块显式依赖本地 QR;提现历史无需 QR。
|
||||
// credits.js 经收银台间接使用 QR,不能把这条支付依赖误认成海报依赖。
|
||||
assert.match(scripts, /\['credits-affiliate' => \['loader_js', 'aksrt-qrcode'\]\]/)
|
||||
assert.match(scripts, /'aksrt-credits'[\s\S]*?\['loader_js', 'aksrt-vip-coordinator', 'aksrt-pay-cashier'\]/)
|
||||
assert.doesNotMatch(scripts, /'credits-withdraw-history' => \['loader_js', 'aksrt-qrcode'\]/)
|
||||
})
|
||||
|
||||
test('client IP honours the trusted-proxy filter before CDN headers', () => {
|
||||
|
||||
Reference in new issue
Block a user