Skip to content

Commit

Permalink
Add test for layout service weight ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg committed Feb 25, 2017
1 parent 2f0947c commit 31a0ba7
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/core.layoutService.tests.js
Expand Up @@ -390,4 +390,43 @@ describe('Test the layout service', function() {
expect(chart.chartArea.top).toBeCloseToPixel(0);
});
});

describe('ordering by weight', function() {
it('should keep higher weights outside', function() {
var chart = window.acquireChart({
type: 'bar',
data: {
datasets: [
{
data: [10, 5, 0, 25, 78, -10]
}
],
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5', 'tick6']
},
options: {
legend: {
display: true,
position: 'left',
},
title: {
display: true,
position: 'bottom',
},
},
}, {
canvas: {
height: 150,
width: 250
}
});

var xAxis = chart.scales['x-axis-0'];
var yAxis = chart.scales['y-axis-0'];
var legend = chart.legend;
var title = chart.titleBlock;

expect(yAxis.left).toBe(legend.right);
expect(xAxis.bottom).toBe(title.top);
});
});
});

0 comments on commit 31a0ba7

Please sign in to comment.