-
Notifications
You must be signed in to change notification settings - Fork 68
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
Feature/Checkbox rework from CC into FC #2104
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
259bc4b
[Checkbox]: rework from class component into FC
vik753 f2fed51
Merge branch 'develop' into feature/Checkbox_FC
vik753 7e05457
[Checkbox]: wrapped component into forwardedRef
vik753 f59125f
Merge branch 'develop' into feature/Checkbox_FC
vik753 efec7c1
Merge branch 'develop' into feature/Checkbox_FC
vik753 a94adf2
[Checkbox]: refactored tests
vik753 24e6eff
Merge branch 'develop' into feature/Checkbox_FC
vik753 6bc1b5f
updated snapshots
vik753 00f74bc
[Checkbox]: removed snapshot test from uui-components
vik753 2fb2a33
updated snapshots
vik753 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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import React from 'react'; | ||
import { Checkbox } from '../Checkbox'; | ||
import { renderer } from '@epam/uui-test-utils'; | ||
import { renderSnapshotWithContextAsync } from '@epam/uui-test-utils'; | ||
import { Checkbox } from '@epam/uui'; | ||
|
||
describe('Checkbox', () => { | ||
it('should be rendered correctly', () => { | ||
const tree = renderer.create(<Checkbox value={ null } onValueChange={ jest.fn } />).toJSON(); | ||
describe('TestComponent', () => { | ||
it('should render with minimum props', async () => { | ||
const tree = await renderSnapshotWithContextAsync(<Checkbox value={ true } onValueChange={ jest.fn } />); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('should be rendered correctly', () => { | ||
const tree = renderer.create(<Checkbox value={ null } onValueChange={ jest.fn } size="18" mode="cell" />).toJSON(); | ||
it('should render with maximum props', async () => { | ||
const tree = await renderSnapshotWithContextAsync(<Checkbox value={ null } onValueChange={ jest.fn } size="18" mode="cell" />); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add wider range of different props to this test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,30 @@ | ||
import React from 'react'; | ||
import { CheckboxGroup } from '../CheckboxGroup'; | ||
import { renderer } from '@epam/uui-test-utils'; | ||
import { renderSnapshotWithContextAsync } from '@epam/uui-test-utils'; | ||
|
||
describe('CheckboxGroup', () => { | ||
it('should be rendered correctly', () => { | ||
const tree = renderer | ||
.create( | ||
<CheckboxGroup | ||
value={ null } | ||
onValueChange={ () => {} } | ||
items={ [{ id: 1, name: 'Test1' }, { id: 2, name: 'Test2' }] } | ||
/>, | ||
) | ||
.toJSON(); | ||
it('should be rendered correctly', async () => { | ||
const tree = await renderSnapshotWithContextAsync( | ||
<CheckboxGroup | ||
value={ null } | ||
onValueChange={ () => {} } | ||
items={ [{ id: 1, name: 'Test1' }, { id: 2, name: 'Test2' }] } | ||
/>, | ||
); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('should be rendered correctly with props', () => { | ||
const tree = renderer | ||
.create( | ||
<CheckboxGroup | ||
value={ null } | ||
onValueChange={ () => {} } | ||
items={ [{ id: 1, name: 'Test1' }, { id: 2, name: 'Test2' }] } | ||
direction="horizontal" | ||
isDisabled | ||
/>, | ||
) | ||
.toJSON(); | ||
it('should be rendered correctly with props', async () => { | ||
const tree = await renderSnapshotWithContextAsync( | ||
<CheckboxGroup | ||
value={ null } | ||
onValueChange={ () => {} } | ||
items={ [{ id: 1, name: 'Test1' }, { id: 2, name: 'Test2' }] } | ||
direction="horizontal" | ||
isDisabled | ||
/>, | ||
); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
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.
Such cases better check via snapshot tests, just render Checkbox with invalid state. I guess we can add this case to the snapshot in UUI.
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.
done