Files
SupplierSystem/server/tests/mpPickingRowPhotoPreview.test.ts
T
雨天 15682b859c
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
小程序分拣: 出库照可点击预览大图
分拣行内出库照缩略图此前没有点击事件(只其它面板有预览),只能看 88rpx 小图。

给 .row-photo-item 加 bindtap → wx.previewImage 看大图(用会话内 tempFilePath —— photo.path 是对象存储 key,不能直接预览);删除按钮仍 catchtap,点「×」只删除、不误触预览。不改拍照/上传/落库链路,零新增文案。
2026-10-16 14:21:08 +08:00

34 lines
1.3 KiB
TypeScript

import { readFileSync } from 'fs';
import { describe, expect, it } from 'vitest';
/**
* 小程序分拣「出库照」可点击预览(2026-10-16 开发者:点缩略图看大图)。
* 设计见 docs/design/20261016-小程序分拣出库照可点击预览.md。
*/
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('缩略图容器绑定 previewItemPhoto(带行 id 与下标)', () => {
expect(wxml).toContain('bindtap="previewItemPhoto"');
expect(wxml).toMatch(/row-photo-item[\s\S]{0,240}bindtap="previewItemPhoto"/);
expect(wxml).toMatch(/bindtap="previewItemPhoto"[\s\S]{0,120}row-photo-img/);
});
it('删除按钮仍是 catchtap(阻止冒泡 ⇒ 点「×」只删除、不误触预览)', () => {
expect(wxml).toContain('catchtap="removeItemPhoto"');
});
it('previewItemPhoto 用本地临时图列表调 wx.previewImage', () => {
expect(js).toContain('previewItemPhoto(e)');
expect(js).toContain("photos.map((p) => p && p.tempFilePath)");
expect(js).toContain('wx.previewImage({ current: urls[index] || urls[0], urls })');
});
});