From: etimberg Date: Sat, 25 Feb 2017 17:05:36 +0000 (-0500) Subject: Add test for layout service weight ordering X-Git-Tag: v2.6.0~2^2~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b50eac366dbde8c376f9fddc104726936a720628;p=thirdparty%2FChart.js.git Add test for layout service weight ordering --- diff --git a/test/core.layoutService.tests.js b/test/core.layoutService.tests.js index 951ea234e..d5f5fab91 100644 --- a/test/core.layoutService.tests.js +++ b/test/core.layoutService.tests.js @@ -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); + }); + }); });