chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑

This commit is contained in:
hugo committed 2026-08-17 19:56:51 +08:00
1 parent 5ef8329bd8
commit 4ec4e57005
183 files changed
+14653 -3936

No files matched your search

@@ -5,6 +5,8 @@
* 逻辑:断言 1920/1440/1366 下主滚动唯一、底栏 sticky;默认浮窗不进网格;固定侧栏才用双栏 token。
*/
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
/** 方案冻结的三档验收视口。 */
@@ -26,6 +28,12 @@ const PRIMARY_SCROLL_CLASS = 'overflow-y-auto';
/** 浮动证据面板默认锚点(避开 sticky 底栏)。 */
const FLOAT_ANCHOR = { bottomClass: 'bottom-20', zIndexClass: 'z-30' };
const lifecycleNavigationPath = resolve(
__dirname,
'../components/shipping-review/ReviewLifecycleStageNavigation.vue',
);
const reviewWorkbenchPath = resolve(__dirname, '../views/ShippingOrderReviewView.vue');
describe('shipping order review workbench viewport layout contract', () => {
it('freezes three desktop acceptance viewports from the layout plan', () => {
// 关键断言:验收矩阵不得悄悄缩减档位。
@@ -56,4 +64,16 @@ describe('shipping order review workbench viewport layout contract', () => {
expect(share1920).toBeGreaterThanOrEqual(0.65);
expect(share1440).toBeGreaterThanOrEqual(0.62);
});
it('keeps four lifecycle columns while reserving 16rem only for the desktop sidebar', () => {
const lifecycleNavigation = readFileSync(lifecycleNavigationPath, 'utf8');
const reviewWorkbench = readFileSync(reviewWorkbenchPath, 'utf8');
// 关键断言:接收解析为第四阶段;必须断言真实导航组件,不能只验证 spec 内常量。
expect(lifecycleNavigation).toContain('class="grid gap-2 sm:grid-cols-4"');
// sidebar/sidebar_search 是唯一允许预留 16rem 的模式;tabs/hidden/narrow 均落入 contents。
expect(reviewWorkbench).toMatch(/reviewDocumentNavigationMode\.value === 'sidebar'\s*\|\|\s*reviewDocumentNavigationMode\.value === 'sidebar_search'/);
expect(reviewWorkbench).toMatch(/:class="reviewDocumentNavigationUsesSidebar\s*\? 'grid gap-2 lg:grid-cols-\[16rem_minmax\(0,1fr\)\] lg:items-start lg:gap-3'\s*:\s*'contents'"/);
expect(reviewWorkbench).not.toMatch(/reviewDocumentNavigationMode\.value === '(?:tabs|hidden|narrow)'\s*\?\s*'[^']*16rem/);
});
});