forked from heilhead/react-bootstrap-validation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRenderTests.js
58 lines (53 loc) · 1.99 KB
/
RenderTests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict';
import {ValidatedInput,Form, Radio, RadioGroup} from '../src';
// Note: THere is an issue with react-bootstrap and mocking. For now the whole node_modules directory has been unmocked.
describe('React bootstrap validation compilation test', () => {
var React = require('react');
var TestUtils = require('react-addons-test-utils');
beforeEach(function() {
});
it('Renders Form component correctly.', () => {
// Render into document
TestUtils.renderIntoDocument(<div></div>);
TestUtils.renderIntoDocument(
<Form onValidSubmit={ function(event)
{
// Do some work with the validation outcomes
}
} />);
});
it('Renders ValidatedInput component correctly.', () => {
// Render into document
let validSubmit = function(event){};
TestUtils.renderIntoDocument(
<Form onValidSubmit={validSubmit}>
<ValidatedInput
type='text'
label='Email'
name='email'
validate='required,isEmail'
errorHelp={{
required: 'Please enter your email',
isEmail: 'Email is invalid'
}}
/>
</Form>);
});
it('Renders RadioGroup component correctly.', () => {
// Render into document
let validSubmit = function(event){};
TestUtils.renderIntoDocument(
<Form onValidSubmit={validSubmit}>
<RadioGroup name='radio'
value='3'
label='Which one is better?'
validate={v => v === 'cola'}
errorHelp='Pepsi? Seriously?'
labelClassName='col-xs-2'
wrapperClassName='col-xs-10'>
<Radio value='cola' label='Cola' />
<Radio value='pepsi' label='Pepsi' />
</RadioGroup>
</Form>);
});
});