(fix):update credits toast
This commit is contained in:
@@ -193,6 +193,49 @@ test('notyf CSS and WordPress enqueue match the reference contract', () => {
|
||||
assert.match(scripts, /'\/assets\/css\/frontend\/notyf\.css',[\s\S]*?'aksrt-font-awesome-5-v4-shims'/);
|
||||
});
|
||||
|
||||
test('balance center actions use direct fixed-id notyf flows', () => {
|
||||
const credits = read('assets/js/credits.js');
|
||||
const scripts = read('src/Core/ScriptsPart1b.php');
|
||||
const css = read('assets/css/routes/user-center/credits.css');
|
||||
const renderers = [
|
||||
'inc/helpers/user-center-renderers/credits-balance.php',
|
||||
'inc/helpers/user-center-renderers/credits-wallet.php',
|
||||
'inc/helpers/user-center-renderers/transfer-modal.php',
|
||||
'inc/helpers/user-center-renderers/withdraw-modal.php',
|
||||
].map(read).join('\n');
|
||||
|
||||
function section(start, end) {
|
||||
const from = credits.indexOf('function ' + start + '(');
|
||||
const to = credits.indexOf('function ' + end + '(', from + 1);
|
||||
assert.notEqual(from, -1, start + ' should exist');
|
||||
assert.notEqual(to, -1, end + ' should exist');
|
||||
return credits.slice(from, to);
|
||||
}
|
||||
|
||||
const flows = [
|
||||
[section('initSignin', 'initSigninGoto'), 'aksrt-balance-signin-toast'],
|
||||
[section('initBalanceCharge', 'initTransfer'), 'aksrt-balance-charge-toast'],
|
||||
[section('initTransfer', 'initPointsExchange'), 'aksrt-balance-transfer-toast'],
|
||||
[section('initPointsExchange', 'initWithdraw'), 'aksrt-balance-points-toast'],
|
||||
[section('initWithdraw', 'initAssetTabs'), 'aksrt-balance-withdraw-toast'],
|
||||
];
|
||||
|
||||
flows.forEach(([source, id]) => {
|
||||
assert.match(source, new RegExp("notyf\\([^;]+?'load'[^;]+?'" + id + "'\\);"));
|
||||
assert.match(source, new RegExp("notyf\\([^;]+?'danger'[^;]+?'" + id + "'\\);"));
|
||||
assert.match(source, new RegExp("notyf\\([^;]+?'success'[^;]+?'" + id + "'\\);"));
|
||||
assert.doesNotMatch(source, /setTip|data-(?:signin|aksrt-(?:charge|transfer|points-exchange|withdraw))-tip/);
|
||||
});
|
||||
|
||||
assert.match(credits, /notyf\('等待支付结果…', 'load', '', 'aksrt-balance-charge-payment-toast'\)/);
|
||||
assert.match(credits, /onTimeout:[\s\S]*?notyf\([^;]+?'danger'[^;]+?'aksrt-balance-charge-payment-toast'\)/);
|
||||
assert.match(credits, /register\('credits',[\s\S]*?initSignin\(\);[\s\S]*?initBalanceCharge\(\);[\s\S]*?initTransfer\(\);[\s\S]*?initPointsExchange\(\);[\s\S]*?initWithdraw\(\);/);
|
||||
assert.match(credits, /aksrtSigninInitialized[\s\S]*?aksrtPointsExchangeInitialized[\s\S]*?aksrtWithdrawInitialized/);
|
||||
assert.match(scripts, /'aksrt-credits',[\s\S]*?\/assets\/js\/credits\.js',[\s\S]*?\[[^\]]*'aksrt-notyf'[^\]]*\]/);
|
||||
assert.doesNotMatch(renderers, /data-(?:signin|aksrt-(?:charge|transfer|points-exchange|withdraw))-tip/);
|
||||
assert.doesNotMatch(css, /\.uc-(?:modal|balance-card)__tip/);
|
||||
});
|
||||
|
||||
test('legacy frontend toast APIs and selectors are fully removed', () => {
|
||||
const files = [
|
||||
'assets/js',
|
||||
|
||||
Reference in New Issue
Block a user