fix(widgets): align user card action buttons

This commit is contained in:
2026-09-03 21:33:30 +08:00
parent 5b48be68da
commit 4f8ab94fac
5 changed files with 15 additions and 61 deletions
@@ -39,6 +39,10 @@ test('user and author widgets render the reference state contract', () => {
assert.match(data.logged, /<div class="user-desc mt10 muted-2-color em09">/)
assert.doesNotMatch(data.logged, /data-post-type=/)
assert.match(data.logged_buttons, /class="newadd-btns but pw-1em mr6 jb-pink" href="https:\/\/example\.test\/new-post">发布文章<\/a>/)
assert.match(data.logged_buttons, /rel="nofollow" href="https:\/\/example\.test\/user-center" class="but pw-1em ml6 jb-blue">用户中心<\/a>/)
assert.doesNotMatch(data.logged_buttons, /<icon|<text>/)
assert.match(data.author, /^<div class="mb20"><div class="user-card zib-widget widget">/)
assert.match(data.author, /data-lazy-type="lazy_cover"/)
assert.match(data.author, /data-post-type="post" data-post-style="card"/)
@@ -152,6 +152,12 @@ namespace {
'show_button' => false,
]);
$logged_buttons = aksrt_render_user_widget_state('user_card', [
'show_img_bg' => false,
'button_1_text' => '发布文章',
'button_2_text' => '用户中心',
]);
$GLOBALS['aksrt_user_card_state']['current_user_id'] = 2;
$GLOBALS['aksrt_user_card_state']['post'] = new WP_Post(33, 9);
$author = aksrt_render_user_widget_state('author_card', [
@@ -168,6 +174,7 @@ namespace {
'guest_no_registration' => $guest_no_registration,
'closed' => $closed,
'logged' => $logged,
'logged_buttons' => $logged_buttons,
'author' => $author,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}