-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3574 from marmelab/use-useStyles
[RFR] Use makeStyles in Field Components
- Loading branch information
Showing
7 changed files
with
168 additions
and
158 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
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,33 @@ | ||
import React from 'react'; | ||
import assert from 'assert'; | ||
import { shallow } from 'enzyme'; | ||
import expect from 'expect'; | ||
import { ChipField } from './ChipField'; | ||
import { render, cleanup } from '@testing-library/react'; | ||
|
||
describe('<ChipField />', () => { | ||
it('should display the record value added as source', () => | ||
assert.equal( | ||
shallow( | ||
<ChipField | ||
className="className" | ||
classes={{}} | ||
source="name" | ||
record={{ name: 'foo' }} | ||
/> | ||
).prop('label'), | ||
'foo' | ||
)); | ||
afterEach(cleanup); | ||
|
||
it('should not display any label added as props', () => | ||
assert.equal( | ||
shallow( | ||
<ChipField | ||
className="className" | ||
classes={{}} | ||
source="name" | ||
record={{ name: 'foo' }} | ||
label="bar" | ||
/> | ||
).prop('label'), | ||
'foo' | ||
)); | ||
it('should display the record value added as source', () => { | ||
const { getByText } = render( | ||
<ChipField | ||
className="className" | ||
classes={{}} | ||
source="name" | ||
record={{ name: 'foo' }} | ||
/> | ||
); | ||
expect(getByText('foo')).not.toBeNull(); | ||
}); | ||
|
||
it('should not display any label added as props', () => { | ||
const { getByText } = render( | ||
<ChipField | ||
className="className" | ||
classes={{}} | ||
source="name" | ||
record={{ name: 'foo' }} | ||
label="bar" | ||
/> | ||
); | ||
expect(getByText('foo')).not.toBeNull(); | ||
}); | ||
}); |
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.