diff --git a/src/Select.tsx b/src/Select.tsx index 7d5f1704..c5b5ad1b 100644 --- a/src/Select.tsx +++ b/src/Select.tsx @@ -140,7 +140,7 @@ export interface SelectProps { expect(onKeyUp).toHaveBeenCalled(); }); - it('warning if label not same as option', () => { - const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); - mount( - , - ); - expect(errorSpy).toHaveBeenCalledWith( - 'Warning: `label` of `value` is not same as `label` in Select options.', - ); - errorSpy.mockRestore(); + describe('warning if label not same as option', () => { + it('should work', () => { + resetWarned(); + + const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + mount( + , + ); + expect(errorSpy).toHaveBeenCalledWith( + 'Warning: `label` of `value` is not same as `label` in Select options.', + ); + errorSpy.mockRestore(); + }); + + it('not warning for react node', () => { + resetWarned(); + const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + + const Demo = () => { + const [, setVal] = React.useState(0); + + return ( +