Skip to content

Commit

Permalink
Prettier changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuykendall committed Jan 22, 2021
1 parent b8ef92b commit d3602b5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
5 changes: 3 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ With the `preventExternalInvalidation` the input will not be invalidated though
`updateInputsWithError()` or an `invalidate` callback is called.

### <a id="formElement">formElement</a>
By default Formsy render the form with the HTML `form` element.
If you want to override this behaviour, you can pass the element to render in the `formElement` props

By default Formsy render the form with the HTML `form` element. If you want to override this behaviour, you can pass the
element to render in the `formElement` props

```jsx
<Formsy formElement="div">
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ A form input builder and validator for React.
| [Quick Start](#quick-start) | [API](/API.md) | [1.x API](https://github.com/formsy/formsy-react/blob/v1.x/API.md) |
| --------------------------- | -------------- | ------------------------------------------------------------------ |


## Background

[christianalfoni](https://github.com/christianalfoni/) wrote an article on forms and validation with React,
Expand Down Expand Up @@ -41,8 +40,8 @@ if you're looking for old issues.

- [twisty/formsy-react-components](https://github.com/twisty/formsy-react-components) - Bootstrap components for a
Formsy-React form.
- [zabute/formsy-semantic-ui-react](https://github.com/zabute/formsy-semantic-ui-react) - Semantic-Ui-React components for a
Formsy-React form.
- [zabute/formsy-semantic-ui-react](https://github.com/zabute/formsy-semantic-ui-react) - Semantic-Ui-React components
for a Formsy-React form.

## 1.x to 2.x Upgrade Guide

Expand Down
2 changes: 1 addition & 1 deletion __tests__/Element.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('Element', () => {
mount(
<Formsy action="/users">
<Input name="foo" value="" />
<Input name="foo" value="" required />
<Input name="foo" value="" required />
<Input name="foo" value="foo" required="isLength:3" />
</Formsy>,
);
Expand Down
18 changes: 7 additions & 11 deletions __tests__/Formsy.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1052,16 +1052,12 @@ describe('onSubmit/onValidSubmit/onInvalidSubmit', () => {

describe('<Formsy /> can render any tag or element with the props as', () => {
it('as div', () => {
const form = mount(
<Formsy formElement="div" />
);
expect(form.find('div').length).toBe(1)
})
const form = mount(<Formsy formElement="div" />);
expect(form.find('div').length).toBe(1);
});
it('as CustumElement', () => {
const CustomElement = ({ children }) => <div>{children}</div>;
const form = mount(
<Formsy formElement={CustomElement} />
);
expect(form.find(CustomElement).length).toBe(1)
})
})
const form = mount(<Formsy formElement={CustomElement} />);
expect(form.find(CustomElement).length).toBe(1);
});
});
3 changes: 2 additions & 1 deletion src/withFormsy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ function getDisplayName(component: WrappedComponentClass) {
export default function withFormsy<T, V>(
WrappedComponent: React.ComponentType<T & PassDownProps<V>>,
): React.ComponentType<Omit<T & WrapperProps<V>, keyof InjectedProps<V>>> {
class WithFormsyWrapper extends React.Component<T & WrapperProps<V> & FormsyContextInterface, WrapperState<V>>
class WithFormsyWrapper
extends React.Component<T & WrapperProps<V> & FormsyContextInterface, WrapperState<V>>
implements WrapperInstanceMethods<V> {
public validations?: Validations<V>;

Expand Down

0 comments on commit d3602b5

Please sign in to comment.