[TextField] onTouchTap on label
Problem description
When calling "mount" on Enzyme on "TextField", this error occurs in Jest:
console.error node_modules/fbjs/lib/warning.js:36
Warning: Unknown prop `onTouchTap` on <label> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
in label (created by TextFieldLabel)
in TextFieldLabel (created by TextField)
in div (created by TextField)
in TextField (created by AddressField)
in AddressField (created by PhoneNumberInput)
in PhoneNumberInput (created by Unknown)
in Unknown
Link to minimally-working code that reproduces the issue
import 'jsdom-global/register';
import React, {PropTypes} from 'react';
import { mount } from 'enzyme';
import TextField from 'material-ui/TextField';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
describe('TextField Component', () => {
const muiTheme = getMuiTheme();
const context = { muiTheme };
const childContextTypes = { muiTheme: React.PropTypes.object };
it('console error', () => {
const wrapper = mount(
<TextField floatingLabelText='hi'/>, { context, childContextTypes }
);
expect(1).toBe(1);
});
});
Versions
- Material-UI: 0.16.5
- React: 15.4.1
- Browser: N/A
This happens with the example code provided on the website (http://www.material-ui.com/#/get-started/usage) as well.
They suggested using a plugin to avoid this warning but I think it's kind of annoying because at least I don't want an extra plugin for this single warning.
@CryZe Please submit a PR preferably (or separate issue otherwise) for that.
@johntran https://github.com/callemall/material-ui/issues/5390#issuecomment-260974005
This happens to me as well, specifically on "TextFieldLabel" component like above. I am already calling injectTapEventPlugin at the top of my entry point, but it doesn't help. I still get the warning.
@mbrookes Calling injectTapEventPlugin fixed it for me :)