|
|
@@ -130,8 +130,9 @@ describe('签名实现重写 v2(竖屏直签 + canvas 2d)· signature.canvas
|
|
|
})
|
|
|
|
|
|
test('TC-SIG2D-01c 不再调用 wx.setPageOrientation / screen.orientation.lock', function () {
|
|
|
- expect(pageScript).not.toMatch(/setPageOrientation/)
|
|
|
- expect(pageScript).not.toMatch(/orientation\.lock/)
|
|
|
+ // 只匹配「调用形式」(带括号),排除注释中的引用文字(v2 实现注释明确写"不再调用…")
|
|
|
+ expect(pageScript).not.toMatch(/setPageOrientation\s*\(/)
|
|
|
+ expect(pageScript).not.toMatch(/orientation\.lock\s*\(/)
|
|
|
})
|
|
|
|
|
|
test('TC-SIG2D-02 computeCanvasHeight 保留竖屏计算(174/214 两档 + 160 下限)', function () {
|
|
|
@@ -152,8 +153,10 @@ describe('签名实现重写 v2(竖屏直签 + canvas 2d)· signature.canvas
|
|
|
const opts = loadOptions(PAD, { uni: {}, wx: undefined, window: undefined })
|
|
|
const data = typeof opts.data === 'function' ? opts.data() : opts.data
|
|
|
expect(data).toHaveProperty('_canvasNode', null)
|
|
|
- // canvasId 赋值应含 "(this._uid || 0)" 保证多实例唯一
|
|
|
- expect(String(data.canvasId)).toMatch(/hsCanvas_.*_uid/)
|
|
|
+ // canvasId 唯一化:运行时输出为 hsCanvas_<数字>;静态求值拿不到真实 _uid 时按 0 兜底
|
|
|
+ expect(String(data.canvasId)).toMatch(/^hsCanvas_\d+$/)
|
|
|
+ // 源码必须保留 "(this._uid || 0)" 拼接机制,保证多实例唯一(参照 RadarChart)
|
|
|
+ expect(padScript).toMatch(/hsCanvas_['"]?\s*\+\s*\(?(this\._uid|this\.uid)\s*\|\|\s*0/)
|
|
|
})
|
|
|
|
|
|
test('TC-SIG2D-04 mounted 用 createSelectorQuery().in(this).select("#canvasId").fields({node:true,size:true,rect:true})', function () {
|