Skip to content

Instantly share code, notes, and snippets.

@kvendrik
Last active November 6, 2018 21:50
Show Gist options
  • Save kvendrik/f7bf26fe27ce94dde14e786ea1496076 to your computer and use it in GitHub Desktop.
Save kvendrik/f7bf26fe27ce94dde14e786ea1496076 to your computer and use it in GitHub Desktop.
TextField example - test setup
import * as React from 'react';
import {mount} from 'enzyme';
import {noop} from '@shopify/javascript-utilities/other';
import TextField from '../TextField';
describe('<TextField />', () => {
const mockProps = {
onChange: noop,
};
describe('type', () => {
it('passes the specified type into the input', () => {
const type = 'email';
const textField = mount(<TextField {...mockProps} type={type} />);
expect(textField.find('input').prop('type')).toBe(type);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment