Skip to content

Commit

Permalink
Stop using string refs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi committed Mar 30, 2018
1 parent e25f7af commit 6501ec5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export default class FuzzySearch extends Component {
type="text"
style={styles.searchBoxStyle}
onChange={this.handleChange}
ref="searchBox"
placeholder={placeholder}
autoFocus={autoFocus}
value={this.state.selectedValue && this.state.selectedValue.title}
Expand Down
10 changes: 5 additions & 5 deletions src/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('<FuzzySearch />', () => {
placeholder="testing"
/>,
);
const placeholder = wrapper.ref('searchBox').prop('placeholder');
const placeholder = wrapper.find('input').prop('placeholder');
expect(placeholder).to.equal('testing');
});

Expand All @@ -46,7 +46,7 @@ describe('<FuzzySearch />', () => {
<FuzzySearch onSelect={onSelect} keys={['author', 'title']} list={list} />,
);

const input = wrapper.ref('searchBox');
const input = wrapper.find('input');
expect(wrapper.state('results').length).to.equal(0);

input.simulate('change', {
Expand All @@ -64,7 +64,7 @@ describe('<FuzzySearch />', () => {
<FuzzySearch list={list} onSelect={onChange} keys={['author', 'title']} id="id" />,
);

const input = wrapper.ref('searchBox');
const input = wrapper.find('input');
input.simulate('change', {
target: {
value: 't',
Expand All @@ -80,7 +80,7 @@ describe('<FuzzySearch />', () => {
<FuzzySearch list={list} onSelect={onChange} keys={['author', 'title']} />,
);

const input = wrapper.ref('searchBox');
const input = wrapper.find('input');
input.simulate('change', {
target: {
value: 't',
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('<FuzzySearch />', () => {
/>,
);

const input = wrapper.ref('searchBox');
const input = wrapper.find('input');
input.simulate('change', {
target: {
value: 't',
Expand Down

0 comments on commit 6501ec5

Please sign in to comment.