fix(user-home): add reference tab loading skeletons
This commit is contained in:
@@ -570,16 +570,24 @@ test('public user home stays param-free and swaps panels via REST fragments', ()
|
||||
|
||||
// Shell mounts panel wrappers from the tab registry with a user id hook.
|
||||
assert.match(shell, /data-user-id="<\?php echo \(int\) \$user_id; \?>">/);
|
||||
assert.match(shell, /get_template_part\('templates\/parts\/user-home\/panel', \$panel_tab, \$ctx\)/);
|
||||
assert.match(shell, /in_array\(\$panel_tab, \['favorites', 'follow'\], true\) && \$panel_tab !== \$active_tab/);
|
||||
assert.match(shell, /data-panel-loaded="<\?php echo \$defer_panel \? 'false' : 'true'; \?>"/);
|
||||
assert.match(shell, /get_template_part\('templates\/parts\/user-home\/panel', \$panel_tab, \$panel_context\)/);
|
||||
|
||||
// Follow panel: button-driven sub-tabs, pagination without URL building.
|
||||
assert.match(follow, /data-uh-sub="followers"/);
|
||||
assert.match(follow, /data-uh-sub="following"/);
|
||||
assert.match(follow, /aksrt_render_user_home_pagination\(\$total_pages, \$follow_page\)/);
|
||||
assert.match(ctx, /function aksrt_get_user_home_follow_placeholder\(\): string[\s\S]*?author-minicard radius8 flex ac uh-follow__placeholder[\s\S]*?placeholder k1 mb6[\s\S]*?placeholder s1/);
|
||||
assert.match(ctx, /str_repeat\(\$item, 6\)/);
|
||||
assert.match(follow, /aksrt_get_user_home_follow_placeholder\(\)/);
|
||||
assert.match(follow, /data-uh-retry[\s\S]*?重试/);
|
||||
assert.doesNotMatch(follow, /add_query_arg|\$_GET|paginate_links/);
|
||||
|
||||
assert.match(comments, /data-uh-comments-next=/);
|
||||
assert.match(favorites, /aksrt_render_user_home_pagination\(/);
|
||||
assert.match(favorites, /if \(!empty\(\$placeholder_only\)\)[\s\S]*?aksrt_render_placeholder\(\$placeholder_mode, 4\)/);
|
||||
assert.match(favorites, /data-uh-retry[\s\S]*?重试/);
|
||||
assert.doesNotMatch(comments + favorites, /add_query_arg|\$_GET/);
|
||||
|
||||
// REST fragment endpoint serves public panel bodies.
|
||||
@@ -593,6 +601,16 @@ test('public user home stays param-free and swaps panels via REST fragments', ()
|
||||
assert.match(authorJs, /data-uh-sub/);
|
||||
assert.match(authorJs, /post_ajax\.ed/);
|
||||
assert.match(authorJs, /window\.auto_fun\(\)/);
|
||||
assert.match(authorJs, /panel\.dataset\.panelLoaded === 'false'[\s\S]*?loadPanelBody\(panel, name, 1, 'followers'\)/);
|
||||
assert.match(authorJs, /target\.closest\('\[data-uh-retry\]'\)[\s\S]*?loadPanelBody\(retryPanel, retryName, 1, 'followers'\)/);
|
||||
assert.match(authorJs, /panel\.dataset\.panelLoaded = 'true'/);
|
||||
assert.match(authorJs, /panel\.classList\.add\('is-load-error'\)/);
|
||||
const userHomeCss = read('assets/css/routes/user-home.css');
|
||||
assert.match(userHomeCss, /dashboard-panel\.is-loading \.uh-follow__list--placeholder\s*\{\s*display: block;/);
|
||||
assert.match(userHomeCss, /dashboard-panel\.is-loading \.uh-follow__subtabs,[\s\S]*?dashboard-panel\.is-loading \.uh-follow__list:not\(\.uh-follow__list--placeholder\),[\s\S]*?dashboard-panel\.is-loading \.uh-pagination,[\s\S]*?dashboard-panel\.is-loading \.profile-empty\s*\{\s*display: none;/);
|
||||
assert.match(userHomeCss, /dashboard-panel\.is-load-error \.uh-follow__list--placeholder\s*\{\s*display: block;/);
|
||||
assert.match(userHomeCss, /dashboard-panel\.is-load-error \.post_ajax_loader\s*\{\s*display: block;/);
|
||||
assert.match(userHomeCss, /dashboard-panel\.is-load-error \.uh-panel-load-error\s*\{\s*display: block;/);
|
||||
|
||||
// 翻页拿子分组只读**当前面板内**的 is-active 子页签,不读 panel.dataset:
|
||||
// uhSub 是粉丝面板私有状态,写满所有面板会互相串味 —— 先点过粉丝子页签,
|
||||
|
||||
Reference in New Issue
Block a user