diff --git a/CHANGELOG.md b/CHANGELOG.md index 932206b..add7bf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ### 0.1.1 (November 21, 2017) -- added possibility to add props to form element via [formProps](https://github.com/cat-react/form/blob/master/docs/api.md#formprops) prop +- now it is possible to add an [autoComplete](https://github.com/cat-react/form/blob/master/docs/api.md#autocomplete) prop to the form element - the validation rule `isRequired` now checks for `undefined`, `null` or an empty string. everything else is valid ### 0.1.0 (October 3, 2017) diff --git a/docs/api.md b/docs/api.md index a6b671b..e5b3360 100644 --- a/docs/api.md +++ b/docs/api.md @@ -11,7 +11,7 @@ Welcome to the `@cat-react/form` API documentation. - [onValid](#onvalidvalues) - [onInvalid](#oninvalidvalues-isvalidating) - [className](#classname) - - [formProps](#formprops) + - [autoComplete](#autocomplete) - [Input](#input) (HOC for building input fields) - Retrieves - [value](#value) @@ -308,12 +308,12 @@ will result in: --- -### formProps -Props which will be passed directly to the
html element. +### autoComplete +AutoComplete prop which will be passed directly to the html element. For example: ```jsx - + ``` will result in: diff --git a/examples/Login/index.js b/examples/Login/index.js index 8ee3c21..4b3eda7 100644 --- a/examples/Login/index.js +++ b/examples/Login/index.js @@ -42,7 +42,8 @@ export default class extends React.Component { + onValidSubmit={this.onValidSubmit} + autoComplete="off">

Login

+ {children} ); diff --git a/tests/Form.spec.js b/tests/Form.spec.js index 8d1b542..c27b66a 100644 --- a/tests/Form.spec.js +++ b/tests/Form.spec.js @@ -43,12 +43,9 @@ describe('Form', () => { expect(onInvalid).not.toHaveBeenCalled(); }); - it('should pass all props', () => { - let wrapper = shallow(
abc
); - const props = wrapper.props(); - expect(props.autocomplete).toBe('off'); - expect(props.className).toBe('myForm'); - expect(props.fantasy).toBe(true); + it('should pass all props correctly', () => { + let wrapper = shallow(
abc
); + expect(wrapper.html()).toBe('
abc
'); }); it('should add the vaidationRule', () => {