fix(frontend): keep asset and homepage filters in DOM
This commit is contained in:
@@ -78,16 +78,32 @@ test('user asset submissions send idempotency keys', () => {
|
||||
})
|
||||
|
||||
test('profile asset records show order references and only the changed amount', () => {
|
||||
for (const file of ['profile-credits.php', 'credits-transactions.php']) {
|
||||
for (const file of ['credits-transactions.php', 'credits-wallet-ledger.php']) {
|
||||
const source = fs.readFileSync(path.join(root, 'inc', 'helpers', 'user-center-renderers', file), 'utf8')
|
||||
assert.match(source, /\$record_note\s*=\s*\(string\) \$row\['reason'\] === 'points_exchange'[\s\S]*?\(string\) \$row\['ref_key'\]/)
|
||||
assert.doesNotMatch(source, /uc-transactions__balance|交易 #%d|\$row\['fee_minor'\]|\$row\['ref_id'\]/)
|
||||
}
|
||||
})
|
||||
|
||||
test('asset record tabs and pagination stay in the DOM without URL state', () => {
|
||||
const profile = fs.readFileSync(path.join(root, 'inc', 'helpers', 'user-center-renderers', 'profile-credits.php'), 'utf8')
|
||||
const points = fs.readFileSync(path.join(root, 'inc', 'helpers', 'user-center-renderers', 'credits-transactions.php'), 'utf8')
|
||||
const wallet = fs.readFileSync(path.join(root, 'inc', 'helpers', 'user-center-renderers', 'credits-wallet-ledger.php'), 'utf8')
|
||||
const credits = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
|
||||
const center = fs.readFileSync(path.join(root, 'src', 'User', 'Center.php'), 'utf8')
|
||||
|
||||
assert.match(profile, /data-aksrt-asset-tab="balance"/)
|
||||
assert.match(profile, /data-aksrt-asset-tab="points"/)
|
||||
assert.match(points, /aksrt_render_asset_pagination\([^;]+, 'points'\)/)
|
||||
assert.match(wallet, /aksrt_render_asset_pagination\([^;]+, 'balance'\)/)
|
||||
assert.doesNotMatch(profile + points + wallet, /\$_GET\[['"](?:wallet_page|credits_page)['"]\]/)
|
||||
assert.match(credits, /data-aksrt-asset-page/)
|
||||
assert.match(credits, /user-center\/panel\/credits\?asset=/)
|
||||
assert.match(center, /'asset'\s*=>\s*\[/)
|
||||
assert.match(center, /\$context\['asset_request'\]/)
|
||||
})
|
||||
test('core asset paths never use floating-point money helpers', () => {
|
||||
const files = [
|
||||
'src/Ledger/AssetAmount.php',
|
||||
'src/Ledger/LedgerCommand.php',
|
||||
'src/Ledger/LedgerService.php',
|
||||
'src/Credits/BalanceService.php',
|
||||
|
||||
Reference in New Issue
Block a user