forked from thoughtworks/HeartBeat
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adm 944 [frontend] add trending icon in chart (#1472)
* ADM-944 feat: add trend number and icon * ADM-944 refactor: extract trend color * ADM-944 feat: add dara trend * ADM-944 refactor: refactor * ADM-944 feat: add tooltip * ADM-944 fix: fix eslint * ADM-944 test: add unit test * ADM-944 test: fix test * ADM-944 refactor: rename * ADM-944: [frontend] feat: add test * ADM-944: [frontend] feat: fix lint * ADM-944: [frontend] feat: change import to @src * ADM-944: [frontend] feat: fix sonar isuue * ADM-944: [frontend] feat: fix prettier --------- Co-authored-by: Leiqiuhong <[email protected]>
- Loading branch information
1 parent
ef20d99
commit 22f65b1
Showing
11 changed files
with
401 additions
and
69 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
frontend/__tests__/containers/ReportStep/ChartAndTitleWrapper.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,33 @@ | ||
import ChartAndTitleWrapper from '@src/containers/ReportStep/ChartAndTitleWrapper'; | ||
import { CHART_TYPE, TREND_ICON } from '@src/constants/resources'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
describe('ChartAndTitleWrapper', () => { | ||
it('should render green up icon when icon is set to up and green', () => { | ||
const testedTrendInfo = { | ||
color: 'green', | ||
icon: TREND_ICON.UP, | ||
trendNumber: 83.72, | ||
type: CHART_TYPE.VELOCITY, | ||
}; | ||
render(<ChartAndTitleWrapper trendInfo={testedTrendInfo} />); | ||
const icon = screen.getByTestId('TrendingUpSharpIcon'); | ||
|
||
expect(icon).toBeInTheDocument(); | ||
expect(icon.parentElement?.parentElement).toHaveStyle({ color: 'green' }); | ||
}); | ||
|
||
it('should render down icon when icon is set to down', () => { | ||
const testedTrendInfo = { | ||
color: 'red', | ||
icon: TREND_ICON.DOWN, | ||
trendNumber: -83.72, | ||
type: CHART_TYPE.VELOCITY, | ||
}; | ||
render(<ChartAndTitleWrapper trendInfo={testedTrendInfo} />); | ||
const icon = screen.getByTestId('TrendingDownSharpIcon'); | ||
|
||
expect(screen.getByTestId('TrendingDownSharpIcon')).toBeInTheDocument(); | ||
expect(icon.parentElement?.parentElement).toHaveStyle({ color: 'red' }); | ||
}); | ||
}); |
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.