固定销售单据为241×140毫米并自动缩放长单

This commit is contained in:
summer committed 2026-10-22 12:59:56 +08:00
1 parent b9154a752d
commit 5265a2e568
8 files changed
+70 -24

No files matched your search

+3 -2
View File
@@ -28,10 +28,11 @@ test('注意事项按最新要求去掉维修承诺,取消退货仍注明原
assert.ok(!html.includes('免费维修'));assert.ok(!html.includes('仅收取配件费用'));
for(const status of ['returned','cancelled'])assert.ok(receipt({...sample,status}).includes('原单成交额'));
});
test('单页模板接受紧凑纸张和长备注,所有商品与收费完整保留',()=>{
test('固定横版单页保留超多商品、收费和长备注,不受旧尺寸设置影响',()=>{
const lines=Array.from({length:60},(_,i)=>({...sample.lines[0],name:'测试商品'+i,charges:[{name:'附加服务'+i,amount:100}]}));
const html=receipt({...sample,lines,note:'长备注'.repeat(80)},settings({width:241,height:140,rows:12,rowHeight:16}));
const html=receipt({...sample,lines,note:'长备注'.repeat(80)},settings({width:300,height:400,rows:12,rowHeight:16}));
assert.equal((html.match(/<section class="sheet /g)||[]).length,1);assert.ok(html.includes('测试商品59'));assert.ok(html.includes('附加服务59'));assert.ok(html.includes('长备注'.repeat(80)));assert.ok(!html.includes('overflow:hidden'));assert.ok(html.includes('/print.js'));
assert.match(html,/@page\{size:241mm 140mm;margin:0\}/);
for(const mode of ['full','overlay']){
const printed=receipt({...sample,lines},{},mode);
const numbers=[...printed.matchAll(/<tr><td>([^<]+)<\/td>/g)].map(m=>m[1]);