|
1 |
| -// /* eslint react/no-multi-comp:0 react/jsx-no-bind:0 */ |
2 |
| -// import { assert } from 'chai'; |
3 |
| -// import React, { Component, PropTypes } from 'react'; |
4 |
| -// import TestUtils from 'react-addons-test-utils'; |
5 |
| -// import { applyMiddleware, combineReducers, createStore } from 'redux'; |
6 |
| -// import { Provider } from 'react-redux'; |
7 |
| -// import thunk from 'redux-thunk'; |
8 |
| - |
9 |
| -// import { controls, createFieldClass, formReducer, modelReducer, Control } from '../src'; |
10 |
| - |
11 |
| -// function createTestStore(reducers) { |
12 |
| -// return applyMiddleware(thunk)(createStore)(combineReducers(reducers)); |
13 |
| -// } |
14 |
| - |
15 |
| -// describe('<Control> component', () => { |
16 |
| -// it('should exist as a function', () => { |
17 |
| -// assert.ok(Control); |
18 |
| -// }); |
19 |
| - |
20 |
| -// it.only('should work as expected with a model (happy path)', () => { |
21 |
| -// const store = createTestStore({ |
22 |
| -// test: modelReducer('test', { foo: 'bar' }), |
23 |
| -// testForm: formReducer('test', { foo: 'bar' }), |
24 |
| -// }); |
25 |
| - |
26 |
| -// const form = TestUtils.renderIntoDocument( |
27 |
| -// <Provider store={store}> |
28 |
| -// <Control model="test.foo" mapProps={controls.text} component={React.DOM.input} /> |
29 |
| -// </Provider> |
30 |
| -// ); |
31 |
| - |
32 |
| -// const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); |
33 |
| - |
34 |
| -// console.log(input); |
35 |
| - |
36 |
| -// }) |
37 |
| -// }); |
| 1 | +/* eslint react/no-multi-comp:0 react/jsx-no-bind:0 */ |
| 2 | +import { assert } from 'chai'; |
| 3 | +import React from 'react'; |
| 4 | +import TestUtils from 'react-addons-test-utils'; |
| 5 | +import { applyMiddleware, combineReducers, createStore } from 'redux'; |
| 6 | +import { Provider } from 'react-redux'; |
| 7 | +import thunk from 'redux-thunk'; |
| 8 | + |
| 9 | +import { controls, formReducer, modelReducer, Control } from '../src'; |
| 10 | + |
| 11 | +function createTestStore(reducers) { |
| 12 | + return applyMiddleware(thunk)(createStore)(combineReducers(reducers)); |
| 13 | +} |
| 14 | + |
| 15 | +describe('<Control> component', () => { |
| 16 | + it('should exist', () => { |
| 17 | + assert.ok(Control); |
| 18 | + }); |
| 19 | + |
| 20 | + it('should work as expected with a model (happy path)', () => { |
| 21 | + const store = createTestStore({ |
| 22 | + test: modelReducer('test', { foo: 'bar' }), |
| 23 | + testForm: formReducer('test', { foo: 'bar' }), |
| 24 | + }); |
| 25 | + |
| 26 | + const form = TestUtils.renderIntoDocument( |
| 27 | + <Provider store={store}> |
| 28 | + <Control model="test.foo" mapProps={controls.text} component="input" /> |
| 29 | + </Provider> |
| 30 | + ); |
| 31 | + |
| 32 | + const input = TestUtils.findRenderedDOMComponentWithTag(form, 'input'); |
| 33 | + |
| 34 | + assert.ok(input); |
| 35 | + }); |
| 36 | +}); |
0 commit comments