-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(TDOPS-872): VList content cell should display a tooltip for 0 val…
…ue (#4901) * fix(TDOPS-872): VList content cell should display a tooltip for 0 value * enhance proptypes and fix tests * Cleanup
- Loading branch information
Showing
10 changed files
with
120 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@talend/react-components': patch | ||
--- | ||
|
||
TDOPS-872 - VList cell content should display a tooltip for 0 value as well |
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
32 changes: 32 additions & 0 deletions
32
packages/components/src/VirtualizedList/Content.component.test.js
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,32 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { defaultColumnConfiguration } from './Content.component'; | ||
|
||
jest.unmock('@talend/design-system'); | ||
|
||
describe('CellLabel', () => { | ||
const CellContent = defaultColumnConfiguration.cellRenderer; | ||
it('should default render a label', () => { | ||
// given | ||
const label = 'my label'; | ||
// when | ||
const { container } = render(<CellContent cellData={label} columnData={{}} />); | ||
// then | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render a tooltip if available', () => { | ||
// given | ||
const label = 'my label'; | ||
// when | ||
render( | ||
<CellContent | ||
cellData={label} | ||
columnData={{ | ||
tooltipLabel: 0, | ||
}} | ||
/>, | ||
); | ||
// then | ||
expect(screen.getByTestId('tc-virtualizedlist-default-cell-tooltip')).toBeVisible(); | ||
}); | ||
}); |
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
12 changes: 12 additions & 0 deletions
12
packages/components/src/VirtualizedList/__snapshots__/Content.component.test.js.snap
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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CellLabel should default render a label 1`] = ` | ||
<div | ||
aria-describedby="42" | ||
class="tc-virtualizedlist-default-cell" | ||
data-test="tc-virtualizedlist-default-cell-tooltip" | ||
data-testid="tc-virtualizedlist-default-cell-tooltip" | ||
> | ||
my label | ||
</div> | ||
`; |
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