diff --git a/app/components/validation-input.js b/app/components/validation-input.js index 8cf76b9..8a83b09 100644 --- a/app/components/validation-input.js +++ b/app/components/validation-input.js @@ -70,7 +70,7 @@ class ValidationInput extends Component { return (
{element} - {error && + {error && (
{errorCodes[error] || error}
-
} + + )} ); } diff --git a/app/validation.stories.js b/app/validation.stories.js index 1649674..db5c594 100644 --- a/app/validation.stories.js +++ b/app/validation.stories.js @@ -39,21 +39,17 @@ const aliasedRules = [ ]; storiesOf('Validation', module) - .add('default', () => + .add('default', () => (
- + - + @@ -63,8 +59,8 @@ storiesOf('Validation', module)
- ) - .add('custom validation rules', () => + )) + .add('custom validation rules', () => (
- + - + @@ -93,8 +85,8 @@ storiesOf('Validation', module)
- ) - .add('styled error block', () => + )) + .add('styled error block', () => (
- + - + @@ -126,7 +114,7 @@ storiesOf('Validation', module)
- ); + )); const Input = styled.input`margin-top: 10px;`; diff --git a/app/validation.test.js b/app/validation.test.js index fbe8954..d936daa 100644 --- a/app/validation.test.js +++ b/app/validation.test.js @@ -82,7 +82,10 @@ describe('Validation', () => { } }); expect( - wrapper.find(ValidationInput).at(0).find('[data-error-block]') + wrapper + .find(ValidationInput) + .at(0) + .find('[data-error-block]') ).toHaveLength(1); wrapper.find(`input[name="${LOGIN}"]`).simulate('change', { target: { @@ -90,7 +93,10 @@ describe('Validation', () => { } }); expect( - wrapper.find(ValidationInput).at(1).find('[data-error-block]') + wrapper + .find(ValidationInput) + .at(1) + .find('[data-error-block]') ).toHaveLength(1); expect(wrapper.find('button').props().disabled).toBeTruthy(); @@ -99,13 +105,23 @@ describe('Validation', () => { value: '123' } }); - expect(wrapper.find(ValidationInput).at(0).find('div')).toHaveLength(1); + expect( + wrapper + .find(ValidationInput) + .at(0) + .find('div') + ).toHaveLength(1); wrapper.find(`input[name="${LOGIN}"]`).simulate('change', { target: { value: '456' } }); - expect(wrapper.find(ValidationInput).at(1).find('div')).toHaveLength(1); + expect( + wrapper + .find(ValidationInput) + .at(1) + .find('div') + ).toHaveLength(1); expect(wrapper.find('button').props().disabled).toBeFalsy(); }); diff --git a/package.json b/package.json index 0416e61..ddb56af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-livr-validation", - "version": "1.0.3", + "version": "1.0.4", "description": "react validation component with LIVR as validation engine", "main": "dist/bundle.js", "scripts": { @@ -49,10 +49,13 @@ "react": "^15.6.1" }, "devDependencies": { + "@storybook/react": "^3.2.8", "babel-eslint": "^7.2.3", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", "cross-env": "^5.0.5", "enzyme": "^2.9.1", "eslint": "^4.4.1",