-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Search*): use React.forwardRef() (#4270)
- Loading branch information
1 parent
4565f8c
commit ee09958
Showing
11 changed files
with
66 additions
and
33 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
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react' | ||
|
||
import SearchCategoryLayout from 'src/modules/Search/SearchCategoryLayout' | ||
import * as common from 'test/specs/commonTests' | ||
|
||
const requiredProps = { | ||
categoryContent: <div />, | ||
resultsContent: <div />, | ||
} | ||
|
||
describe('SearchCategoryLayout', () => { | ||
common.isConformant(SearchCategoryLayout, { requiredProps, rendersChildren: false }) | ||
}) |
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,9 +1,23 @@ | ||
import React from 'react' | ||
|
||
import SearchResult from 'src/modules/Search/SearchResult' | ||
import * as common from 'test/specs/commonTests' | ||
import { sandbox } from 'test/utils' | ||
|
||
const requiredProps = { title: '' } | ||
|
||
describe('SearchResult', () => { | ||
common.isConformant(SearchResult, { requiredProps }) | ||
common.forwardsRef(SearchResult, { requiredProps }) | ||
common.propKeyOnlyToClassName(SearchResult, 'active', { requiredProps }) | ||
|
||
describe('onClick', () => { | ||
it('is called with (e, data) when clicked', () => { | ||
const onClick = sandbox.spy() | ||
mount(<SearchResult onClick={onClick} {...requiredProps} />).simulate('click') | ||
|
||
onClick.should.have.been.calledOnce() | ||
onClick.should.have.been.calledWithMatch({ type: 'click' }, requiredProps) | ||
}) | ||
}) | ||
}) |
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