fix(frontend): align reward modal with shared runtime

This commit is contained in:
2026-10-05 03:24:42 +08:00
parent 6037ca184b
commit 356f7fe5bd
14 changed files with 337 additions and 630 deletions
@@ -26,7 +26,6 @@ const routed = [
'assets/js/author.js',
'assets/js/credits.js',
'assets/js/order-center.js',
'assets/js/reward.js',
'assets/js/routes/user-center.js',
'assets/js/signin.js',
'assets/js/section-navs.js',
@@ -99,6 +98,34 @@ test('routed modules use one namespaced auto_fun owner and no registry', () => {
}
});
test('wallet reward content opens in the shared modal runtime once', () => {
const reward = read('assets/js/reward.js');
const helper = read('inc/helpers/aksrt-rewards.php');
const authorBar = read('templates/parts/single-author-bar.php');
const singleActions = read('inc/helpers/aksrt-single-render.php');
const scripts = read('src/Core/ScriptsPart1b.php');
assert.match(reward, /runtime\.open\(\{/);
assert.match(reward, /className: 'aksrt-reward-modal modal-mini full-sm'/);
assert.match(reward, /mobileBottom: true/);
assert.match(reward, /shell\.setAttribute\('aria-labelledby', title\.id\)/);
assert.match(reward, /'Idempotency-Key': key/);
assert.equal((reward.match(/document\.addEventListener\('click'/g) || []).length, 1);
assert.doesNotMatch(reward, /auto_fun|reward-modal\.is-open/);
assert.equal((helper.match(/<template\b/g) || []).length, 1);
assert.match(helper, /data-template-id="%2\$s"/);
assert.match(helper, /static \$done = \[\]/);
assert.match(helper, /isset\(\$done\[\$key\]\)/);
assert.match(helper, /modal-colorful-header colorful-bg jb-blue/);
assert.match(helper, /data-aksrt-modal-close/);
assert.match(helper, /data-aksrt-reward-submit/);
assert.match(authorBar, /aksrt_render_rewards_template_for_user/);
assert.match(singleActions, /aksrt_render_rewards_template_for_user/);
assert.match(scripts, /'needs_reward'\s*=>\s*'single-post\/rewards'/);
assert.doesNotMatch(helper + authorBar + singleActions, /aksrt_render_rewards_modal_for_user|reward-modal__qr/);
});
test('user center navigation initializes once across auto_fun rescans', () => {
const source = read('assets/js/routes/user-center.js');
const initAt = source.indexOf('function initDashboardNavigation()');
@@ -220,7 +220,6 @@ test('dead cover css is removed from every stylesheet surface', () => {
'assets/css/main.min.css',
'assets/css/build/public.css',
'assets/css/build/public.min.css',
'assets/css/frontend/enhancements/components/base.css',
]) {
const css = read(file);
assert.doesNotMatch(css, /\.single-cover-slide[,{ ]/, `${file} 不得再包含死的 .single-cover-slide 规则`);