Skip to content

Commit

Permalink
Use empty labels for tests so as not to be affected by the font width
Browse files Browse the repository at this point in the history
  • Loading branch information
nagix committed Nov 19, 2018
1 parent ecf64d3 commit 5974a4d
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions test/specs/plugin.legend.tests.js
Expand Up @@ -205,8 +205,8 @@ describe('Legend block tests', function() {
expect(chart.legend.legendHitBoxes.length).toBe(3);

[
{h: 12, l: 107, t: 10, w: 93},
{h: 12, l: 210, t: 10, w: 93},
{h: 12, l: 106, t: 10, w: 93},
{h: 12, l: 209, t: 10, w: 93},
{h: 12, l: 312, t: 10, w: 93}
].forEach(function(expected, i) {
expect(chart.legend.legendHitBoxes[i].height).toBeCloseToPixel(expected.h);
Expand Down Expand Up @@ -453,14 +453,13 @@ describe('Legend block tests', function() {
expect(chart.legend.width).toBeCloseToPixel(512);
expect(chart.legend.height).toBeCloseToPixel(54);
expect(chart.legend.legendHitBoxes.length).toBe(5);
expect(chart.legend.legendHitBoxes.length).toBe(5);

[
{h: 12, l: 56, t: 10, w: 93},
{h: 12, l: 54, t: 10, w: 93},
{h: 12, l: 158, t: 10, w: 93},
{h: 12, l: 261, t: 10, w: 93},
{h: 12, l: 364, t: 10, w: 93},
{h: 12, l: 210, t: 32, w: 93}
{h: 12, l: 209, t: 32, w: 93}
].forEach(function(expected, i) {
expect(chart.legend.legendHitBoxes[i].height).toBeCloseToPixel(expected.h);
expect(chart.legend.legendHitBoxes[i].left).toBeCloseToPixel(expected.l);
Expand Down Expand Up @@ -490,7 +489,7 @@ describe('Legend block tests', function() {

expect(chart.legend.left).toBeCloseToPixel(0);
expect(chart.legend.top).toBeCloseToPixel(6);
expect(chart.legend.width).toBeCloseToPixel(228.7);
expect(chart.legend.width).toBeCloseToPixel(230.5);
expect(chart.legend.height).toBeCloseToPixel(478);
expect(chart.legend.legendHitBoxes.length).toBe(22);

Expand All @@ -504,19 +503,19 @@ describe('Legend block tests', function() {
{h: 12, l: 10, t: 148, w: 93},
{h: 12, l: 10, t: 170, w: 93},
{h: 12, l: 10, t: 192, w: 93},
{h: 12, l: 10, t: 214, w: 99},
{h: 12, l: 10, t: 236, w: 99},
{h: 12, l: 10, t: 258, w: 99},
{h: 12, l: 10, t: 280, w: 99},
{h: 12, l: 10, t: 302, w: 99},
{h: 12, l: 10, t: 324, w: 99},
{h: 12, l: 10, t: 346, w: 99},
{h: 12, l: 10, t: 368, w: 99},
{h: 12, l: 10, t: 390, w: 99},
{h: 12, l: 10, t: 412, w: 99},
{h: 12, l: 10, t: 434, w: 99},
{h: 12, l: 10, t: 456, w: 99},
{h: 12, l: 119, t: 16, w: 99}
{h: 12, l: 10, t: 214, w: 100},
{h: 12, l: 10, t: 236, w: 100},
{h: 12, l: 10, t: 258, w: 100},
{h: 12, l: 10, t: 280, w: 100},
{h: 12, l: 10, t: 302, w: 100},
{h: 12, l: 10, t: 324, w: 100},
{h: 12, l: 10, t: 346, w: 100},
{h: 12, l: 10, t: 368, w: 100},
{h: 12, l: 10, t: 390, w: 100},
{h: 12, l: 10, t: 412, w: 100},
{h: 12, l: 10, t: 434, w: 100},
{h: 12, l: 10, t: 456, w: 100},
{h: 12, l: 120, t: 16, w: 100}
].forEach(function(expected, i) {
expect(chart.legend.legendHitBoxes[i].height).toBeCloseToPixel(expected.h);
expect(chart.legend.legendHitBoxes[i].left).toBeCloseToPixel(expected.l);
Expand Down

0 comments on commit 5974a4d

Please sign in to comment.