-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TSVB] Adds a color picker in percentiles and percentiles rank aggs (#…
…107390) * WIP - Improve the way that percentiles are rendered in TSVB * Adds color picker to percentile and percentile ranks * initialize color * Be backwards compatible * Fixes unit tests * Add a unit test for percentile rank * Fix unit tests * Address PR comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
de9d784
commit 2ebdf3e
Showing
17 changed files
with
364 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...pe_timeseries/public/application/components/aggs/percentile_rank/multi_value_row.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallowWithIntl } from '@kbn/test/jest'; | ||
import { MultiValueRow } from './multi_value_row'; | ||
import { ColorPicker } from '../../color_picker'; | ||
|
||
describe('MultiValueRow', () => { | ||
const model = { | ||
id: 95, | ||
value: '95', | ||
color: '#00028', | ||
}; | ||
const props = { | ||
model, | ||
enableColorPicker: true, | ||
onChange: jest.fn(), | ||
onDelete: jest.fn(), | ||
onAdd: jest.fn(), | ||
disableAdd: false, | ||
disableDelete: false, | ||
}; | ||
|
||
const wrapper = shallowWithIntl(<MultiValueRow {...props} />); | ||
|
||
it('displays a color picker if the enableColorPicker prop is true', () => { | ||
expect(wrapper.find(ColorPicker).length).toEqual(1); | ||
}); | ||
|
||
it('not displays a color picker if the enableColorPicker prop is false', () => { | ||
const newWrapper = shallowWithIntl(<MultiValueRow {...props} enableColorPicker={false} />); | ||
expect(newWrapper.find(ColorPicker).length).toEqual(0); | ||
}); | ||
|
||
it('sets the picker color to the model color', () => { | ||
expect(wrapper.find(ColorPicker).prop('value')).toEqual('#00028'); | ||
}); | ||
|
||
it('should have called the onChange function on color change', () => { | ||
wrapper.find(ColorPicker).simulate('change'); | ||
expect(props.onChange).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.