修复了一些问题
This commit is contained in:
1 parent
ff521c9ad6
commit
9b6088986a
2 files changed
+3
-2
No files matched your search
@@ -270,7 +270,7 @@ function aksrt_render_message_center_detail(array $item, string $view): void {
|
|||||||
<button type="button" class="message-detail__back" data-message-back data-view="<?php echo esc_attr($view); ?>"><i class="fa fas fa-arrow-left" aria-hidden="true"></i> <?php esc_html_e('返回消息列表', 'aksrt'); ?></button>
|
<button type="button" class="message-detail__back" data-message-back data-view="<?php echo esc_attr($view); ?>"><i class="fa fas fa-arrow-left" aria-hidden="true"></i> <?php esc_html_e('返回消息列表', 'aksrt'); ?></button>
|
||||||
<span class="message-detail__icon"><i class="<?php echo esc_attr(aksrt_message_icon_class($type)); ?>" aria-hidden="true"></i></span>
|
<span class="message-detail__icon"><i class="<?php echo esc_attr(aksrt_message_icon_class($type)); ?>" aria-hidden="true"></i></span>
|
||||||
<h2 class="message-detail__title"><?php echo esc_html((string) ($item['title'] ?? '')); ?></h2>
|
<h2 class="message-detail__title"><?php echo esc_html((string) ($item['title'] ?? '')); ?></h2>
|
||||||
<p class="message-detail__meta"><?php echo esc_html(aksrt_notification_type_label($type)); ?> · <?php echo esc_html(aksrt_message_time($item)); ?></p>
|
<p class="message-detail__meta"><?php echo esc_html(aksrt_message_time($item)); ?></p>
|
||||||
</header>
|
</header>
|
||||||
<div class="message-detail__content"><?php echo wp_kses_post(wpautop(esc_html((string) ($item['desc'] ?? '')))); ?></div>
|
<div class="message-detail__content"><?php echo wp_kses_post(wpautop(esc_html((string) ($item['desc'] ?? '')))); ?></div>
|
||||||
<footer class="message-detail__actions">
|
<footer class="message-detail__actions">
|
||||||
|
|||||||
@@ -88,12 +88,13 @@ test('tabs, pagination, actions, and detail all replace DOM fragments', () => {
|
|||||||
assert.doesNotMatch(script, /pushState\([^\n]+detail/);
|
assert.doesNotMatch(script, /pushState\([^\n]+detail/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('message detail does not expose a related-content button or target link', () => {
|
test('message detail exposes neither internal type labels nor a related-content link', () => {
|
||||||
const center = read('inc/modules/message-center.php');
|
const center = read('inc/modules/message-center.php');
|
||||||
const detailStart = center.indexOf('function aksrt_render_message_center_detail');
|
const detailStart = center.indexOf('function aksrt_render_message_center_detail');
|
||||||
const detailEnd = center.indexOf("add_action('wp_ajax_aksrt_load_message_center'", detailStart);
|
const detailEnd = center.indexOf("add_action('wp_ajax_aksrt_load_message_center'", detailStart);
|
||||||
const detail = center.slice(detailStart, detailEnd);
|
const detail = center.slice(detailStart, detailEnd);
|
||||||
|
|
||||||
|
assert.doesNotMatch(detail, /aksrt_notification_type_label/);
|
||||||
assert.doesNotMatch(detail, /查看相关内容|message-detail__primary|target_url|\['url'\]/);
|
assert.doesNotMatch(detail, /查看相关内容|message-detail__primary|target_url|\['url'\]/);
|
||||||
assert.doesNotMatch(detail, /<a\s/i);
|
assert.doesNotMatch(detail, /<a\s/i);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user