优化:产品查询数据库分页并修复报告测试契约
This commit is contained in:
@@ -27,7 +27,16 @@ for(const type of ['line','area'])test(`900px report ${type} keeps a positive pl
|
||||
assert.equal(points.length,18);
|
||||
const ys=points.filter((_,i)=>i%2===1);
|
||||
assert.ok(Math.max(...ys)-Math.min(...ys)>8,'different rates must not become a flat line');
|
||||
ys.forEach((y,i)=>assert.ok(Math.abs(y-(rect.y+rect.height*(1-v.series[0].values[i])))<.001));
|
||||
const series=chart.getModel().getSeriesByIndex(0).getData();
|
||||
const [low,high]=chart.getModel().getComponent('yAxis').axis.scale.getExtent();
|
||||
assert.ok(low>0 && high-low<20,'rate trends retain their focused percentage axis');
|
||||
ys.forEach((y,i)=>{
|
||||
const expected=v.series[0].values[i]*100;
|
||||
assert.ok(Math.abs(series.get('y',i)-expected)<1e-10,'the plotted value preserves the formal rate');
|
||||
assert.ok(expected>=low&&expected<=high,'the value must fit inside the actual axis');
|
||||
const pixel=rect.y+rect.height*(high-expected)/(high-low);
|
||||
assert.ok(Math.abs(y-pixel)<.001,'SVG coordinates match the formal rate on the actual axis');
|
||||
});
|
||||
assert.match(chart.renderToSVGString(),/<svg/);
|
||||
} finally {chart.dispose();}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user