chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑
This commit is contained in:
1 parent
5ef8329bd8
commit
4ec4e57005
183 files changed
+14653
-3936
No files matched your search
+79
-2
@@ -20,6 +20,13 @@ const i18n = createI18n({
|
||||
unnamedDocument: '未命名 PDF',
|
||||
documentNavigation: '导航',
|
||||
caseStatuses: { draft: '草稿', unknown: '未知' },
|
||||
lifecycle: {
|
||||
stages: {
|
||||
order_review: '订单复核',
|
||||
fulfillment_prep: '通知准备',
|
||||
upload_complete: '通知完成',
|
||||
},
|
||||
},
|
||||
otNav: {
|
||||
listTitle: '订单列表 · {count}',
|
||||
searchPlaceholder: '搜索',
|
||||
@@ -71,16 +78,65 @@ describe('ReviewDocumentNavigation', () => {
|
||||
expect(wrapper.find('[data-testid="review-document-navigation"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('uses top tabs for 2–4 OTs', () => {
|
||||
const wrapper = mountNav(3, 'tabs');
|
||||
it('uses compact top tabs for 2–4 OTs', () => {
|
||||
const wrapper = mountNav(3);
|
||||
expect(wrapper.find('[data-testid="review-doc-nav-tabs"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-doc-nav-list"]').exists()).toBe(false);
|
||||
expect(wrapper.attributes('data-nav-mode')).toBe('tabs');
|
||||
});
|
||||
|
||||
it('uses sidebar list for 5–20 OTs', () => {
|
||||
const wrapper = mountNav(8, 'sidebar');
|
||||
expect(wrapper.find('[data-testid="review-doc-nav-list"]').exists()).toBe(true);
|
||||
expect(wrapper.attributes('data-nav-mode')).toBe('sidebar');
|
||||
expect(wrapper.classes()).toContain('sticky');
|
||||
});
|
||||
|
||||
it('keeps the sidebar collapse rail and the explicitly forced sidebar mode', async () => {
|
||||
const wrapper = mount(ReviewDocumentNavigation, {
|
||||
props: {
|
||||
items: items(8),
|
||||
activeCaseNo: 'C-1',
|
||||
navAriaLabel: 'nav',
|
||||
forceMode: 'sidebar',
|
||||
initiallyCollapsed: true,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
// 关键断言:生命周期四阶段兼容不能改变既有的强制侧栏与编号折叠轨交互。
|
||||
expect(wrapper.attributes('data-nav-mode')).toBe('sidebar');
|
||||
expect(wrapper.get('[data-testid="review-doc-nav-C-2"]').text()).toContain('2');
|
||||
await wrapper.get('[data-testid="review-doc-nav-collapse"]').trigger('click');
|
||||
expect(wrapper.get('[data-testid="review-doc-nav-C-2"]').text()).toContain('f2.pdf');
|
||||
});
|
||||
|
||||
it('keeps the file name as the queue row title while projecting PO, lifecycle stage and status', () => {
|
||||
const rows = items(5);
|
||||
rows[1] = {
|
||||
...rows[1],
|
||||
file_name: 'purchase-order-2.pdf',
|
||||
po_number: 'PO-002',
|
||||
lifecycle_stage: 'fulfillment_prep',
|
||||
status: 'processing',
|
||||
};
|
||||
const wrapper = mount(ReviewDocumentNavigation, {
|
||||
props: {
|
||||
items: rows,
|
||||
activeCaseNo: 'C-1',
|
||||
navAriaLabel: 'nav',
|
||||
forceMode: 'sidebar',
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
|
||||
// 文件导航先展示可识别的文件名;PO/阶段/状态仍都来自后端队列 DTO。
|
||||
const queueRow = wrapper.get('[data-testid="review-doc-nav-C-2"]');
|
||||
expect(queueRow.find('.font-medium').text()).toBe('purchase-order-2.pdf');
|
||||
expect(queueRow.text()).toContain('PO-002');
|
||||
expect(queueRow.text()).toContain('通知准备');
|
||||
// 关键断言:队列行内容必须是实际 DOM 子节点,不能被原生 template 隐藏成空白框。
|
||||
expect(queueRow.find('template').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('shows search for 20+ OTs', () => {
|
||||
@@ -94,4 +150,25 @@ describe('ReviewDocumentNavigation', () => {
|
||||
await wrapper.get('[data-testid="review-doc-nav-C-2"]').trigger('click');
|
||||
expect(wrapper.emitted('select')?.[0]).toEqual(['C-2']);
|
||||
});
|
||||
|
||||
it('keeps backend lifecycle stage visible in tabs and narrow queue', async () => {
|
||||
const rows = items(2);
|
||||
rows[1] = { ...rows[1], lifecycle_stage: 'fulfillment_prep', status: 'processing' };
|
||||
const tabs = mount(ReviewDocumentNavigation, {
|
||||
props: { items: rows, activeCaseNo: 'C-1', navAriaLabel: 'nav', forceMode: 'tabs' },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
const narrow = mount(ReviewDocumentNavigation, {
|
||||
props: { items: rows, activeCaseNo: 'C-1', navAriaLabel: 'nav', forceMode: 'narrow' },
|
||||
global: { plugins: [i18n] },
|
||||
attachTo: document.body,
|
||||
});
|
||||
|
||||
// 关键断言:文件队列在任何响应式形态都只投影后端已裁决阶段。
|
||||
expect(tabs.get('[data-testid="review-doc-nav-C-2"]').text()).toContain('通知准备');
|
||||
await narrow.get('[data-testid="review-doc-nav-narrow-trigger"]').trigger('click');
|
||||
// 窄屏抽屉通过 Teleport 挂到 body,断言真实可见容器而非组件根节点。
|
||||
expect(document.body.querySelector('[data-testid="review-doc-nav-C-2"]')?.textContent).toContain('通知准备');
|
||||
narrow.unmount();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user