fix(navigation): align header wallet tiles with reference

This commit is contained in:
2026-10-11 14:55:23 +08:00
parent 60e4d67772
commit 7ed739615e
7 changed files with 70 additions and 7 deletions
@@ -175,6 +175,9 @@ test('guest account member VIP and publish contracts share reference header DOM'
assert.match(userboxCss, /\.aksrt-nav-notification \.aksrt-notification-badge/);
assert.doesNotMatch(userboxCss, /aksrt-header-wallet|aksrt-header-checkin|aksrt-header-payvip|\.aksrt-header-userbox \.aksrt-notification-badge/);
assert.doesNotMatch(userboxCss, /width:\s*260px/);
assert.match(userboxCss, /\.aksrt-header-userbox\s*\{[^}]*line-height:\s*1\.42857143/s);
assert.match(userboxCss, /\.aksrt-header-userbox\s+\.muted-box\.padding-6\s*\{[^}]*background-color:\s*var\(--this-bg,\s*var\(--color-line-soft\)\)[^}]*border-radius:\s*4px[^}]*padding:\s*6px/s);
assert.match(userboxCss, /\.aksrt-header-userbox\s*>\s*\.mt6\.em09\s*>\s*\.but\.block\s*\{[^}]*display:\s*block;[^}]*box-sizing:\s*border-box;[^}]*width:\s*100%;/s);
});
test('the account popover rows match the reference user box structure', () => {
@@ -2,6 +2,7 @@ const test = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const vm = require('node:vm')
const root = path.resolve(__dirname, '..', '..')
@@ -421,6 +422,23 @@ test('asset purchases share the order center and refresh every wallet surface',
assert.match(sidebar, /data-aksrt-points-value/)
assert.match(header, /data-aksrt-wallet-value/)
assert.match(header, /data-aksrt-points-value/)
assert.match(header, /data-aksrt-wallet-value data-aksrt-count-format="cut-count"/)
assert.match(header, /data-aksrt-points-value data-aksrt-count-format="cut-count"/)
assert.match(creditsJs, /element\.dataset\.aksrtCountFormat === 'cut-count' \? formatCutCount\(/)
})
test('header wallet count formatting matches the server cut-count thresholds', () => {
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
const formatterSource = creditsJs.match(/function formatCutCount\(value\) \{[\s\S]*?\n\t\}/)
assert.ok(formatterSource, 'credits runtime must define the header cut-count formatter')
const formatCutCount = vm.runInNewContext('(' + formatterSource[0] + ')')
assert.equal(formatCutCount('0.00'), '0')
assert.equal(formatCutCount('9999'), '9999')
assert.equal(formatCutCount('10000'), '1W+')
assert.equal(formatCutCount('12345'), '1.2W+')
assert.equal(formatCutCount('1000000'), '100W+')
})
test('recharge completion always credits the ledger and expiry SQL is strict-mode safe', () => {