-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathRenderTests.js
More file actions
41 lines (34 loc) · 1.33 KB
/
RenderTests.js
File metadata and controls
41 lines (34 loc) · 1.33 KB
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
'use strict';
import Form from '../src/Form';
// 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');
var validator = require('validator');
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 Form with validation library as prop.', () => {
// Assemble
var form = TestUtils.renderIntoDocument(
<Form validator={validator} onValidSubmit={ function(event) {return true;} } />
);
});
it('Form validation has custom validation rule.', () => {
// Assemble
var form = TestUtils.renderIntoDocument(
<Form validator={validator} onValidSubmit={ function(event) {return true;} } />
);
validator.extend('isTrue', val => { return true; });
expect(form.props.validator.isTrue()).toBe(true);
});
});