-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(highlighter): hide it when tooltip type is None #482
Merged
markov00
merged 5 commits into
elastic:master
from
markov00:2019-12-05_fix_highlighter_on_none_tooltip
Dec 5, 2019
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
10237d1
fix(highlighter): hide when tooltip type is None
markov00 3db5b18
fix: merge partial union types
nickofthyme d6e636c
refactor: rename simpleClone to shallowClone
markov00 a5c5e01
Merge branch 'master' into 2019-12-05_fix_highlighter_on_none_tooltip
markov00 8a17915
Merge branch 'master' into 2019-12-05_fix_highlighter_on_none_tooltip
markov00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
45 changes: 45 additions & 0 deletions
45
src/chart_types/xy_chart/state/chart_state.tooltip.test.ts
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,45 @@ | ||
import { GlobalChartState, chartStoreReducer } from '../../../state/chart_state'; | ||
import { createStore, Store } from 'redux'; | ||
import { upsertSpec, specParsed } from '../../../state/actions/specs'; | ||
import { MockSeriesSpec, MockGlobalSpec } from '../../../mocks/specs'; | ||
import { updateParentDimensions } from '../../../state/actions/chart_settings'; | ||
import { getTooltipValuesAndGeometriesSelector } from './selectors/get_tooltip_values_highlighted_geoms'; | ||
import { onPointerMove } from '../../../state/actions/mouse'; | ||
import { TooltipType } from '../utils/interactions'; | ||
|
||
describe('XYChart - State tooltips', () => { | ||
let store: Store<GlobalChartState>; | ||
beforeEach(() => { | ||
const storeReducer = chartStoreReducer('chartId'); | ||
store = createStore(storeReducer); | ||
store.dispatch(upsertSpec(MockSeriesSpec.bar({ data: [{ x: 1, y: 10 }, { x: 2, y: 5 }] }))); | ||
store.dispatch(upsertSpec(MockGlobalSpec.settings())); | ||
store.dispatch(specParsed()); | ||
store.dispatch(updateParentDimensions({ width: 100, height: 100, top: 0, left: 0 })); | ||
}); | ||
|
||
describe('should compute tooltip values depending on tooltip type', () => { | ||
it.each<[TooltipType, number, number]>([ | ||
[TooltipType.None, 0, 0], | ||
[TooltipType.Follow, 1, 2], | ||
[TooltipType.VerticalCursor, 1, 2], | ||
[TooltipType.Crosshairs, 1, 2], | ||
])('tooltip type %s', (tooltipType, expectedHgeomsLength, expectedTooltipValuesLength) => { | ||
store.dispatch(onPointerMove({ x: 25, y: 50 }, 0)); | ||
store.dispatch( | ||
upsertSpec( | ||
MockGlobalSpec.settings({ | ||
tooltip: { | ||
type: tooltipType, | ||
}, | ||
}), | ||
), | ||
); | ||
store.dispatch(specParsed()); | ||
const state = store.getState(); | ||
const tooltipValues = getTooltipValuesAndGeometriesSelector(state); | ||
expect(tooltipValues.tooltipValues).toHaveLength(expectedTooltipValuesLength); | ||
expect(tooltipValues.highlightedGeometries).toHaveLength(expectedHgeomsLength); | ||
}); | ||
}); | ||
}); |
17 changes: 3 additions & 14 deletions
17
src/chart_types/xy_chart/state/selectors/get_specs.test.ts
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!!