import { readFileSync } from 'fs'; import { describe, expect, it } from 'vitest'; const wxml = readFileSync( new URL('../../miniprogram/components/picking-panel/index.wxml', import.meta.url), 'utf8' ); const js = readFileSync( new URL('../../miniprogram/components/picking-panel/index.js', import.meta.url), 'utf8' ); describe('小程序分拣范围选择框', () => { it('页内点击选范围:按订单/分类/商品都走选择框;完成组不占位', () => { expect(wxml).not.toContain('scroll-x class="task-tabs"'); expect(wxml).toContain('toggleScopeMenu'); expect(wxml).toContain('scope-menu'); expect(wxml).toContain('wx:if="{{scopeGroups.length}}"'); expect(wxml).not.toContain('!skuCatalogMode'); expect(js).toContain('function groupStillOpen'); expect(js).toContain('onScopeOptionTap'); expect(js).toContain('scopeMenuOpen'); expect(js).toContain("if (type === 'category') return String(task.scope_label"); expect(js).toContain("if (type === 'sku') return String(task.scope_label"); expect(js).toContain('this.selectGroupByKey(activeGroupKey)'); expect(js).not.toContain('this.applyPickingDayView()'); }); it('日期轴仍在;小程序不做打印(2026-10-12 起)', () => { expect(wxml).toContain('date-axis'); expect(js).toContain('confirmAllPicks'); // 小程序不做打印:行上打印按钮与下发打印的代码均已移除 expect(wxml).not.toContain('printCurrentPick'); expect(wxml).not.toContain('btn-print-row'); expect(js).not.toContain('printCurrentPick'); expect(js).not.toContain('printPickLabels'); }); });