fix(user): align badge modals with reference theme

This commit is contained in:
kate522 committed 2026-10-29 17:38:10 +08:00
1 parent 8e9d3a7e49
commit 1c501ff713
17 files changed
+931 -313

No files matched your search

@@ -24,10 +24,14 @@ test('badges use server-rendered admin-ajax modal actions only', () => {
assert.match(badges, /wp_ajax_nopriv_aksrt_user_medal_info_modal/);
assert.match(badges, /wp_ajax_nopriv_aksrt_single_medal_info_modal/);
assert.match(identity, /data-aksrt-modal-cache="false"/);
assert.match(identity, /data-aksrt-modal-loading="spinner"/);
assert.match(identity, /data-aksrt-modal-swipe-close="true"/);
assert.match(identity, /admin-ajax\.php/);
assert.match(identity, /aksrt-badge-modal--overview/);
assert.match(identity, /aksrt-badge-modal--grant/);
assert.match(badges, /aksrt-badge-modal--single/);
assert.match(badges, /data-aksrt-modal-loading="spinner"/);
assert.match(badges, /data-aksrt-modal-swipe-close="true"/);
assert.doesNotMatch(identity, /data-aksrt-modal-class="full-sm"/);
assert.doesNotMatch(badges, /data-aksrt-modal-class="modal-mini"/);
assert.match(scripts, /user-badge-actions\.js/);
@@ -49,14 +53,15 @@ test('badge mutations enforce the public nonce, login, ownership, and manual gra
assert.match(badges, /'show_unearned'\s*=>\s*\$show_unearned/);
});
test('badge actions close the HTML dialog and reload the server-rendered page', () => {
test('badge actions close their HTML dialog without reloading the page', () => {
const actions = read('assets/js/user-badge-actions.js');
assert.match(actions, /aksrt_user_medal_wear/);
assert.match(actions, /aksrt_user_medal_manually_add/);
assert.match(actions, /aksrt_user_medal_manually_remove/);
assert.match(actions, /AksrtModalRuntime\.close\('badge-action'\)/);
assert.match(actions, /window\.location\.reload\(\)/);
assert.match(actions, /getActive\(\) === modal/);
assert.doesNotMatch(actions, /window\.location\.reload|setTimeout/);
assert.doesNotMatch(actions, /AksrtRequest|fetchJson|restUrl/);
});
@@ -77,7 +82,8 @@ test('the retired badge rollout and JSON modal CSS are absent', () => {
assert.doesNotMatch(sources, /frontend_modal_rollout_badge/);
assert.doesNotMatch(sources, /\.uc-badges-/);
assert.match(sources, /grid-template-columns:\s*repeat\(5, 1fr\)/);
assert.match(sources, /grid-template-columns:\s*repeat\(4, 1fr\)/);
assert.match(sources, /grid-template-columns:\s*repeat\(3, 1fr\)/);
assert.doesNotMatch(sources, /grid-template-columns|\.medal-card__|\.medal-modal__|\.medal-grant-item/);
const main = read('assets/css/main.css');
assert.match(main, /\.medal-list\s*\{\s*width:\s*calc\(20% - 14px\);\s*margin:\s*10px 7px/);
assert.match(main, /\.medal-list\s*\{\s*width:\s*calc\(25% - 14px\)/);
});