fix(documents): refine unread badges and mark all read

This commit is contained in:
caoxiaozhu
2026-06-03 16:46:13 +08:00
parent 513ff909f9
commit 4717ee6086
8 changed files with 201 additions and 22 deletions

View File

@@ -8,6 +8,11 @@ const sidebar = readFileSync(
'utf8'
)
const sidebarStyles = readFileSync(
fileURLToPath(new URL('../src/assets/styles/components/sidebar-rail.css', import.meta.url)),
'utf8'
)
const documentInbox = readFileSync(
fileURLToPath(new URL('../src/composables/useDocumentCenterInbox.js', import.meta.url)),
'utf8'
@@ -21,13 +26,16 @@ const documentNewState = readFileSync(
test('sidebar renders a red dot for unread document center rows', () => {
assert.match(sidebar, /useDocumentCenterInbox/)
assert.match(sidebar, /hasUnread: documentInboxHasUnread/)
assert.match(sidebar, /<span v-if="item\.hasNewMessage" class="nav-unread-dot" aria-hidden="true"><\/span>/)
assert.match(sidebar, /class="nav-label-text"[\s\S]*class="nav-unread-dot nav-unread-dot-label"/)
assert.match(sidebar, /class="nav-unread-dot nav-unread-dot-collapsed"/)
assert.match(sidebar, /hasNewMessage: item\.id === 'documents' \? documentInboxHasUnread\.value : false/)
assert.match(sidebar, /void refreshDocumentInbox\(\)/)
assert.match(sidebar, /startDocumentInboxPolling\(\)/)
assert.match(sidebar, /stopDocumentInboxPolling\(\)/)
assert.match(sidebar, /\.nav-unread-dot\s*\{[\s\S]*background:\s*#ef4444;/)
assert.match(sidebar, /\.rail-collapsed \.nav-unread-dot\s*\{[\s\S]*position:\s*absolute;/)
assert.match(sidebarStyles, /\.nav-label-text\s*\{[\s\S]*position:\s*relative;/)
assert.match(sidebarStyles, /\.nav-unread-dot\s*\{[\s\S]*background:\s*#ef4444;/)
assert.match(sidebarStyles, /\.nav-unread-dot-label\s*\{[\s\S]*position:\s*absolute;[\s\S]*top:\s*-8px;/)
assert.match(sidebarStyles, /\.rail-collapsed \.nav-unread-dot-collapsed\s*\{[\s\S]*position:\s*absolute;/)
})
test('document inbox reuses document center viewed-key state', () => {