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-997 [frontend]: add new label for new functions (#1577)
* ADM-997 [frontend]: add new label for new functions * ADM-997 [frontend]: responsive for mobile * ADM-997 [frontend]: fix comments * ADM-997 [frontend]: responsive for mobile
- Loading branch information
1 parent
44c68e5
commit e4010f4
Showing
22 changed files
with
395 additions
and
80 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
frontend/__tests__/components/Common/NewFunctionsLabel.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,57 @@ | ||
import NewFunctionsLabel from '@src/components/Common/NewFunctionsLabel'; | ||
import { saveVersion } from '@src/context/meta/metaSlice'; | ||
import { setupStore } from '@test/utils/setupStoreUtil'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { NewLabelType } from '@src/constants/commons'; | ||
import { Provider } from 'react-redux'; | ||
|
||
const store = setupStore(); | ||
|
||
describe('NewFunctionsLabel', () => { | ||
const setup = (version: string, initVersion: string, newLabelType: NewLabelType = NewLabelType.General) => { | ||
store.dispatch(saveVersion(version)); | ||
return render( | ||
<Provider store={store}> | ||
<NewFunctionsLabel initVersion={initVersion} newLabelType={newLabelType}> | ||
test | ||
</NewFunctionsLabel> | ||
</Provider>, | ||
); | ||
}; | ||
|
||
it('should show new label when version from store is less than version that functions create', () => { | ||
setup('1.2.1', '1.3.0'); | ||
|
||
expect(screen.queryByLabelText('new label')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should show new label when version from store is equal to version that functions create', () => { | ||
setup('1.3.0', '1.3.0'); | ||
|
||
expect(screen.queryByLabelText('new label')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not show new label when version from store is more than version that functions create', () => { | ||
setup('1.3.1', '1.3.0'); | ||
|
||
expect(screen.queryByLabelText('new label')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should not show new label when init version exist alpha', () => { | ||
setup('1.3.0', '1.3.0-alpha'); | ||
|
||
expect(screen.queryByLabelText('new label')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should not show new label when init version exist pre-release', () => { | ||
setup('1.3.0', '1.3.0-0.3.1'); | ||
|
||
expect(screen.queryByLabelText('new label')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('should show customize new label when version from store is equal to version that functions create and type is CustomizeMarginAndHeight', () => { | ||
setup('1.3.0', '1.3.0', NewLabelType.CustomizeMarginAndHeight); | ||
|
||
expect(screen.queryByLabelText('new label')).toBeInTheDocument(); | ||
}); | ||
}); |
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.