Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Jul 3, 2020
1 parent 5d9d582 commit c13a2a6
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions x-pack/plugins/lens/public/xy_visualization/xy_expression.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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');
});
});

Expand Down

0 comments on commit c13a2a6

Please sign in to comment.