Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make legend layouting respect padding at the start of columns #5776

Merged
merged 1 commit into from Nov 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions test/specs/plugin.legend.tests.js
Expand Up @@ -525,6 +525,43 @@ describe('Legend block tests', function() {
});
});

it('should not draw legend items outside of the chart bounds', function() {
var chart = window.acquireChart(
{
type: 'line',
data: {
datasets: [1, 2, 3].map(function(n) {
return {
label: 'dataset' + n,
data: []
};
}),
labels: []
},
options: {
legend: {
position: 'right'
}
}
},
{
canvas: {
width: 512,
height: 105
}
}
);

// Check some basic assertions about the test setup
expect(chart.width).toBe(512);
expect(chart.legend.legendHitBoxes.length).toBe(3);

// Check whether any legend items reach outside the established bounds
chart.legend.legendHitBoxes.forEach(function(item) {
expect(item.left + item.width).toBeLessThanOrEqual(chart.width);
});
});

describe('config update', function() {
it ('should update the options', function() {
var chart = acquireChart({
Expand Down