mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
More helper tests
This commit is contained in:
parent
bb0a8991df
commit
702b9553e7
@ -380,6 +380,59 @@ describe('Core helper tests', function() {
|
|||||||
expect(helpers.previousItem(testData, 0, true)).toEqual(2);
|
expect(helpers.previousItem(testData, 0, true)).toEqual(2);
|
||||||
expect(helpers.previousItem(testData, 2, false)).toEqual(1);
|
expect(helpers.previousItem(testData, 2, false)).toEqual(1);
|
||||||
expect(helpers.previousItem(testData, 1, true)).toEqual(0);
|
expect(helpers.previousItem(testData, 1, true)).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it ('should clear a canvas', function() {
|
||||||
|
var context = window.createMockContext();
|
||||||
|
helpers.clear({
|
||||||
|
width: 100,
|
||||||
|
height: 150,
|
||||||
|
ctx: context
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(context.getCalls()).toEqual([{
|
||||||
|
name: 'clearRect',
|
||||||
|
args: [0, 0, 100, 150]
|
||||||
|
}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it ('should draw a rounded rectangle', function() {
|
||||||
|
var context = window.createMockContext();
|
||||||
|
helpers.drawRoundedRectangle(context, 10, 20, 30, 40, 5);
|
||||||
|
|
||||||
|
expect(context.getCalls()).toEqual([{
|
||||||
|
name: 'beginPath',
|
||||||
|
args: []
|
||||||
|
}, {
|
||||||
|
name: 'moveTo',
|
||||||
|
args: [15, 20]
|
||||||
|
}, {
|
||||||
|
name: 'lineTo',
|
||||||
|
args: [35, 20]
|
||||||
|
}, {
|
||||||
|
name: 'quadraticCurveTo',
|
||||||
|
args: [40, 20, 40, 25]
|
||||||
|
}, {
|
||||||
|
name: 'lineTo',
|
||||||
|
args: [40, 55]
|
||||||
|
}, {
|
||||||
|
name: 'quadraticCurveTo',
|
||||||
|
args: [40, 60, 35, 60]
|
||||||
|
}, {
|
||||||
|
name: 'lineTo',
|
||||||
|
args: [15, 60]
|
||||||
|
}, {
|
||||||
|
name: 'quadraticCurveTo',
|
||||||
|
args: [10, 60, 10, 55]
|
||||||
|
}, {
|
||||||
|
name: 'lineTo',
|
||||||
|
args: [10, 25]
|
||||||
|
}, {
|
||||||
|
name: 'quadraticCurveTo',
|
||||||
|
args: [10, 20, 15, 20]
|
||||||
|
}, {
|
||||||
|
name: 'closePath',
|
||||||
|
args: []
|
||||||
|
}])
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -65,10 +65,12 @@
|
|||||||
arc: function() {},
|
arc: function() {},
|
||||||
beginPath: function() {},
|
beginPath: function() {},
|
||||||
bezierCurveTo: function() {},
|
bezierCurveTo: function() {},
|
||||||
|
clearRect: function() {},
|
||||||
closePath: function() {},
|
closePath: function() {},
|
||||||
fill: function() {},
|
fill: function() {},
|
||||||
lineTo: function(x, y) {},
|
lineTo: function(x, y) {},
|
||||||
moveTo: function(x, y) {},
|
moveTo: function(x, y) {},
|
||||||
|
quadraticCurveTo: function() {},
|
||||||
restore: function() {},
|
restore: function() {},
|
||||||
save: function() {},
|
save: function() {},
|
||||||
setLineDash: function() {},
|
setLineDash: function() {},
|
||||||
|
Loading…
Reference in New Issue
Block a user