-
-
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 #8439 from kosmotema/input-label
Fix bugs in SearchInput and TextField related to the `label` property
- Loading branch information
Showing
4 changed files
with
98 additions
and
5 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,30 @@ | ||
import * as React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { testDataProvider } from 'ra-core'; | ||
|
||
import { AdminContext } from '../AdminContext'; | ||
import { SearchInput } from '.'; | ||
import { FilterForm } from '../list'; | ||
|
||
describe('<SearchInput />', () => { | ||
it('should not render label if passed explicit `undefined` value', async () => { | ||
const source = 'test'; | ||
|
||
const filters = [<SearchInput source={source} label={undefined} />]; | ||
const displayedFilters = { | ||
[source]: true, | ||
}; | ||
|
||
const { container } = render( | ||
<AdminContext dataProvider={testDataProvider()}> | ||
<FilterForm | ||
setFilters={jest.fn()} | ||
filters={filters} | ||
displayedFilters={displayedFilters} | ||
/> | ||
</AdminContext> | ||
); | ||
|
||
expect(container.querySelector(`label`)).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