From c13a2a6d905f44b424da0b8746d63b8e932bc2ef Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 3 Jul 2020 18:00:18 +0200 Subject: [PATCH] fix tests --- .../xy_visualization/xy_expression.test.tsx | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx b/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx index 2d03ce48b39ae..e350c55a97992 100644 --- a/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx +++ b/x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx @@ -1036,11 +1036,26 @@ describe('xy_expression', () => { } as XYArgs; const component = getRenderedComponent(dataWithoutFormats, newArgs); - expect((component.find(LineSeries).at(0).prop('color') as Function)!()).toEqual('#550000'); - expect((component.find(LineSeries).at(1).prop('color') as Function)!()).toEqual('#FFFF00'); - expect((component.find(LineSeries).at(2).prop('color') as Function)!()).toEqual('#FEECDF'); + expect( + (component.find(LineSeries).at(0).prop('color') as Function)!({ + yAccessor: 'b', + seriesKeys: ['Bar'], + }) + ).toEqual('#550000'); + expect( + (component.find(LineSeries).at(1).prop('color') as Function)!({ + yAccessor: 'b', + seriesKeys: ['Bar'], + }) + ).toEqual('#FFFF00'); + expect( + (component.find(LineSeries).at(2).prop('color') as Function)!({ + yAccessor: 'b', + seriesKeys: ['Bar'], + }) + ).toEqual('#FEECDF'); }); - test('color is not applied to chart when splitAccessor is defined or when yConfig is not configured', () => { + test('color overwrite is not applied to chart when splitAccessor is defined or when yConfig is not configured', () => { const args = createArgsWithLayers(); const newArgs = { ...args, @@ -1064,8 +1079,18 @@ describe('xy_expression', () => { } as XYArgs; const component = getRenderedComponent(dataWithoutFormats, newArgs); - expect((component.find(LineSeries).at(0).prop('color') as Function)!()).toEqual(null); - expect((component.find(LineSeries).at(1).prop('color') as Function)!()).toEqual(null); + expect( + (component.find(LineSeries).at(0).prop('color') as Function)!({ + yAccessor: 'b', + seriesKeys: ['Bar'], + }) + ).toEqual('#ff0000'); + expect( + (component.find(LineSeries).at(1).prop('color') as Function)!({ + yAccessor: 'b', + seriesKeys: ['Bar'], + }) + ).toEqual('#ff0000'); }); });