[\s\S]*
/
+ )
+ assert.match(documentsCenterView, /v-for="option in statusFilterOptions"/)
+ assert.match(documentsCenterView, /@click="selectStatusTab\(option\.value\)"/)
+})
+
+test('documents center top tabs start from application and show document category labels', () => {
+ assert.doesNotMatch(documentsCenterView, /const DOCUMENT_SCOPE_ALL = '全部'/)
+ assert.match(documentsCenterView, /const DOCUMENT_SCOPE_APPLICATION = '申请单'/)
+ assert.match(documentsCenterView, /const DOCUMENT_SCOPE_REIMBURSEMENT = '报销单'/)
+ assert.match(documentsCenterView, /const DOCUMENT_SCOPE_REVIEW = '审核单'/)
+ assert.match(documentsCenterView, /const DOCUMENT_SCOPE_ARCHIVE = '归档'/)
+ assert.match(documentsCenterView, /const activeScopeTab = ref\(DOCUMENT_SCOPE_APPLICATION\)/)
+ assert.match(
+ documentsCenterView,
+ /const scopeTabs = \[[\s\S]*DOCUMENT_SCOPE_APPLICATION[\s\S]*DOCUMENT_SCOPE_REIMBURSEMENT[\s\S]*DOCUMENT_SCOPE_REVIEW[\s\S]*DOCUMENT_SCOPE_ARCHIVE[\s\S]*\]/
+ )
+ assert.doesNotMatch(documentsCenterView, /DOCUMENT_SCOPE_ALL/)
+})
+
+test('documents center category tabs map to the intended row sources', () => {
+ assert.match(
+ documentsCenterView,
+ /activeScopeTab\.value === DOCUMENT_SCOPE_APPLICATION[\s\S]*row\.documentTypeCode === DOCUMENT_TYPE_APPLICATION/
+ )
+ assert.match(
+ documentsCenterView,
+ /activeScopeTab\.value === DOCUMENT_SCOPE_REIMBURSEMENT[\s\S]*ownedRows\.value\.filter/
+ )
+ assert.match(
+ documentsCenterView,
+ /activeScopeTab\.value === DOCUMENT_SCOPE_REVIEW[\s\S]*return approvalRows\.value/
+ )
+ assert.match(
+ documentsCenterView,
+ /activeScopeTab\.value === DOCUMENT_SCOPE_ARCHIVE[\s\S]*return archiveRows\.value/
+ )
+ assert.match(documentsCenterView, /return allSummaryRows\.value\.filter\(\(row\) => row\.documentTypeCode === DOCUMENT_TYPE_APPLICATION\)/)
+})
+
+test('documents center list shows created time and conditional stay time columns', () => {
+ assert.match(documentsCenterView, /import \{[\s\S]*formatDocumentListTime[\s\S]*resolveDocumentStayTimeDisplay[\s\S]*\} from '..\/utils\/documentCenterTime\.js'/)
+ assert.match(documentsCenterView, /
/)
+ assert.match(documentsCenterView, //)
+ assert.match(documentsCenterView, /单号<\/th>[\s\S]* | 创建时间<\/th>[\s\S]* | 停留时间<\/th>/)
+ assert.match(documentsCenterView, / | \{\{ row\.createdAtDisplay \}\}<\/td>/)
+ assert.match(documentsCenterView, / | \{\{ row\.stayTimeDisplay \}\}<\/td>/)
+ assert.match(
+ documentsCenterView,
+ /const showStayTimeColumn = computed\(\(\) =>[\s\S]*DOCUMENT_SCOPE_APPLICATION[\s\S]*DOCUMENT_SCOPE_REVIEW/
+ )
+ assert.match(documentsCenterView, /createdAtDisplay: formatDocumentListTime\(createdAtSource\)/)
+ assert.match(documentsCenterView, /stayTimeDisplay: resolveDocumentStayTimeDisplay\(normalized\)/)
+})
+
+test('documents center action buttons are scoped to application and reimbursement tabs', () => {
+ assert.match(
+ documentsCenterView,
+ /v-if="\[DOCUMENT_SCOPE_APPLICATION, DOCUMENT_SCOPE_REIMBURSEMENT\]\.includes\(activeScopeTab\)"[\s\S]*class="document-actions"/
+ )
+ assert.match(
+ documentsCenterView,
+ /v-if="activeScopeTab === DOCUMENT_SCOPE_APPLICATION"[\s\S]*@click="emit\('create-application'\)"[\s\S]*发起申请/
+ )
+ assert.match(
+ documentsCenterView,
+ /v-if="activeScopeTab === DOCUMENT_SCOPE_REIMBURSEMENT"[\s\S]*@click="emit\('create-request'\)"[\s\S]*发起报销/
+ )
+ assert.doesNotMatch(documentsCenterView, /create-request-btn secondary/)
+})
+
+test('documents center category tabs render bubble counts for new documents', () => {
+ assert.match(documentsCenterView, /v-for="tab in scopeTabItems"/)
+ assert.match(documentsCenterView, / 99 \? '99\+' : tab\.badgeCount/)
+ assert.match(documentsCenterView, /const scopeNewCountMap = computed\(\(\) => \(\{/)
+ assert.match(
+ documentsCenterView,
+ /\[DOCUMENT_SCOPE_REIMBURSEMENT\]: ownedRows\.value\.filter\(\(row\) => row\.documentTypeCode === DOCUMENT_TYPE_REIMBURSEMENT\)\.length/
+ )
+ assert.match(documentsCenterView, /\[DOCUMENT_SCOPE_REVIEW\]: approvalRows\.value\.length/)
+ assert.match(documentsCenterView, /\[DOCUMENT_SCOPE_ARCHIVE\]: archiveRows\.value\.length/)
+ assert.match(
+ documentsCenterView,
+ /const scopeTabItems = computed\(\(\) =>[\s\S]*badgeCount: scopeNewCountMap\.value\[tab\] \|\| 0/
+ )
+})
+
+test('documents center switches filter conditions by category tab', () => {
+ assert.match(documentsCenterView, /const FILTER_CONFIG_BY_SCOPE = \{/)
+ assert.doesNotMatch(documentsCenterView, /\[DOCUMENT_SCOPE_ALL\]: \{/)
+ assert.match(
+ documentsCenterView,
+ /\[DOCUMENT_SCOPE_APPLICATION\]: \{[\s\S]*sceneFallbackLabel: '申请场景'[\s\S]*statusTitle: '申请状态'[\s\S]*showDocumentType: false/
+ )
+ assert.match(
+ documentsCenterView,
+ /\[DOCUMENT_SCOPE_REIMBURSEMENT\]: \{[\s\S]*statusTitle: '报销状态'[\s\S]*showDocumentType: false/
+ )
+ assert.match(
+ documentsCenterView,
+ /\[DOCUMENT_SCOPE_REVIEW\]: \{[\s\S]*sceneFallbackLabel: '审核场景'[\s\S]*statusTitle: '审核状态'[\s\S]*statusTabs: \['全部', '审批中', '待补充', '已完成'\]/
+ )
+ assert.match(
+ documentsCenterView,
+ /\[DOCUMENT_SCOPE_ARCHIVE\]: \{[\s\S]*dateLabel: '归档时间'[\s\S]*statusTitle: '归档状态'[\s\S]*statusTabs: \['全部', '已完成'\]/
+ )
+ assert.match(documentsCenterView, /v-if="showDocumentTypeFilter" class="document-filter"/)
+ assert.match(documentsCenterView, /:placeholder="activeFilterConfig\.searchPlaceholder"/)
+ assert.match(documentsCenterView, /class="document-status-filter" :aria-label="activeFilterConfig\.statusTitle"/)
+ assert.doesNotMatch(documentsCenterView, /class="status-filter-label"/)
+ assert.match(
+ documentsCenterView,
+ /watch\(activeFilterConfig, \(\) => \{[\s\S]*openFilterKey\.value = ''[\s\S]*datePopover\.value = false[\s\S]*pageSizeOpen\.value = false/
+ )
+})
+
+test('documents center status dropdown derives labels and closes after selection', () => {
+ assert.match(documentsCenterView, /const statusFilterOptions = computed\(\(\) =>/)
+ assert.match(documentsCenterView, /activeFilterConfig\.value\.statusTabs\.map/)
+ assert.match(documentsCenterView, /label: tab === '全部' \? '全部状态' : tab/)
+ assert.match(documentsCenterView, /const statusFilterLabel = computed\(\(\) =>/)
+ assert.match(
+ documentsCenterView,
+ /function selectStatusTab\(value\) \{[\s\S]*activeStatusTab\.value = value[\s\S]*openFilterKey\.value = ''[\s\S]*\}/
+ )
+})
+
+test('documents center status dropdown uses compact filter styling', () => {
+ assert.match(documentsCenterStyles, /\.documents-list\s*\{[\s\S]*grid-template-rows:\s*auto auto minmax\(0,\s*1fr\) auto;/)
+ assert.match(documentsCenterStyles, /\.status-tabs button\s*\{[\s\S]*display:\s*inline-flex;/)
+ assert.match(documentsCenterStyles, /\.scope-tab-badge\s*\{[\s\S]*border-radius:\s*999px;/)
+ assert.match(documentsCenterStyles, /min-width:\s*1320px;/)
+ assert.match(documentsCenterStyles, /\.col-created\s*\{\s*width:\s*10%;\s*\}/)
+ assert.match(documentsCenterStyles, /\.col-stay\s*\{\s*width:\s*9%;\s*\}/)
+ assert.match(documentsCenterStyles, /\.document-status-filter\s*\{[\s\S]*display:\s*inline-flex;/)
+ assert.match(documentsCenterStyles, /\.document-status-filter\s*\{[\s\S]*min-height:\s*38px;/)
+ assert.match(documentsCenterStyles, /\.status-filter-trigger\s*\{[\s\S]*min-width:\s*154px;/)
+ assert.match(documentsCenterStyles, /\.status-filter-menu\s*\{[\s\S]*min-width:\s*154px;/)
+ assert.doesNotMatch(documentsCenterStyles, /\.document-state-tabs\s*\{/)
+ assert.doesNotMatch(documentsCenterStyles, /\.document-status-filter\s*\{[^}]*margin-top:/)
+})
|