Skip to content
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

Links in section description tooltips #2140

Merged
merged 5 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions webview/src/plots/components/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { join } from 'dvc/src/test/util/path'
import { configureStore } from '@reduxjs/toolkit'
import React from 'react'
import React, { ReactElement } from 'react'
import { Provider } from 'react-redux'
import {
cleanup,
Expand Down Expand Up @@ -953,19 +953,29 @@ describe('App', () => {
const [templateInfo, comparisonInfo, checkpointInfo] =
screen.getAllByTestId('info-tooltip-toggle')

const getSectionText = (sectionNode: ReactElement) =>
// eslint-disable-next-line testing-library/no-node-access
sectionNode.props.children || ''

fireEvent.mouseEnter(templateInfo, { bubbles: true })
expect(
screen.getByText(SectionDescription[Section.TEMPLATE_PLOTS])
screen.getByText(
getSectionText(SectionDescription[Section.TEMPLATE_PLOTS])
)
).toBeInTheDocument()

fireEvent.mouseEnter(comparisonInfo, { bubbles: true })
expect(
screen.getByText(SectionDescription[Section.COMPARISON_TABLE])
screen.getByText(
getSectionText(SectionDescription[Section.COMPARISON_TABLE])
)
).toBeInTheDocument()

fireEvent.mouseEnter(checkpointInfo, { bubbles: true })
expect(
screen.getByText(SectionDescription[Section.CHECKPOINT_PLOTS])
screen.getByText(
getSectionText(SectionDescription[Section.CHECKPOINT_PLOTS])
)
).toBeInTheDocument()
})

Expand Down
20 changes: 13 additions & 7 deletions webview/src/plots/components/PlotsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,20 @@ export interface PlotsContainerProps extends CommonPlotsContainerProps {

export const SectionDescription = {
// "Trends"
[Section.CHECKPOINT_PLOTS]:
'Real-time plots based on metrics from the Experiments Table',
[Section.CHECKPOINT_PLOTS]: (
<span>Real-time plots based on metrics from the Experiments Table</span>
),
// "Images"
[Section.COMPARISON_TABLE]:
'Displays image plots side by side across experiments.',
[Section.COMPARISON_TABLE]: (
<span>Displays image plots side by side across experiments.</span>
),
// "Data Series"
[Section.TEMPLATE_PLOTS]:
'Plots of JSON, YAML, CSV, or TSV files, visualized using `dvc plots` templates'
[Section.TEMPLATE_PLOTS]: (
<span>
Plots of JSON, YAML, CSV, or TSV files, visualized using `dvc plots`
templates
</span>
)
}

const InfoIcon = () => (
Expand Down Expand Up @@ -130,7 +136,7 @@ export const PlotsContainer: React.FC<PlotsContainerProps> = ({
/>

{title}
<Tooltip content={tooltipContent} placement="bottom-end">
<Tooltip content={tooltipContent} placement="bottom-end" interactive>
<div
className={styles.infoTooltipToggle}
data-testid="info-tooltip-toggle"
Expand Down