-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve test coverage * Add expectIsValid utility * Cover all validators * Fix typing on Validation spec * 100% * Work on linting and typing * Fix sort * Revert dist
- Loading branch information
1 parent
8b5a0db
commit b8881d0
Showing
34 changed files
with
807 additions
and
844 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
|
||
import Formsy from '../src'; | ||
import { InputFactory } from './TestInput'; | ||
import { getInputInstance } from './getInput'; | ||
|
||
const TestInput = InputFactory({ | ||
render() { | ||
return <input value={this.props.value || ''} readOnly />; | ||
}, | ||
}); | ||
|
||
function ValidationForm(props: { validations: string; value?: any }) { | ||
const { validations, value } = props; | ||
|
||
return ( | ||
<Formsy> | ||
<TestInput name="foo" validations={validations} value={value} /> | ||
</Formsy> | ||
); | ||
} | ||
|
||
export function expectIsValid(testForm: React.ComponentElement<any, any>) { | ||
const form = mount(testForm); | ||
const inputComponent = form.find(TestInput); | ||
return expect(getInputInstance(inputComponent).isValid()); | ||
} | ||
|
||
export default ValidationForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { WrapperInstanceMethods } from '../src/Wrapper'; | ||
import Formsy from '../src'; | ||
|
||
export function getInputInstance(inputComponent) { | ||
return inputComponent.instance() as WrapperInstanceMethods; | ||
} | ||
|
||
export function getFormInstance(formComponent) { | ||
return formComponent.instance() as Formsy; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.