Skip to content

Commit

Permalink
Add tests for inputRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Alec Winograd committed Nov 14, 2016
1 parent 6fcc966 commit df99444
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3061,6 +3061,40 @@ describe('Select', () => {
});
});

describe('inputRenderer', () => {

var inputRenderer;

beforeEach(() => {

inputRenderer = (inputProps) => {
return (
<input id="custom-input" type="text" />
);
};

inputRenderer = sinon.spy(inputRenderer);

instance = createControl({
options: defaultOptions,
inputRenderer: inputRenderer
});
});

it('renders the options using the inputRenderer', () => {
var input = ReactDOM.findDOMNode(instance).querySelector('#custom-input');
expect(input, 'not to equal', undefined);
});

it('calls the renderer exactly once', () => {
expect(inputRenderer, 'was called times', 1);
});

it('calls the renderer with props', () => {
expect(inputRenderer, 'was called with', { value: '', className: 'Select-input' });
});
});

describe('optionRenderer', () => {

var optionRenderer;
Expand Down

0 comments on commit df99444

Please sign in to comment.