11// @flow
22
33import * as React from 'react'
4+ import get from 'lodash.get'
5+ import { Iterable } from 'immutable'
46import { describe , it } from 'mocha'
57import { createStore , combineReducers } from 'redux'
68import { Provider } from 'react-redux'
@@ -26,6 +28,10 @@ function max(threshold: number): (value: number) => ?string {
2628 }
2729}
2830
31+ function getIn ( obj : any , path : any ) : any {
32+ return Iterable . isIterable ( obj ) ? obj . getIn ( path ) : get ( obj , path )
33+ }
34+
2935describe ( 'NumericField' , ( ) => {
3036 function tests ( { NumericField, reducer, reduxForm} : any ) {
3137 it ( 'normalizes valid number on blur' , ( ) => {
@@ -102,6 +108,7 @@ describe('NumericField', () => {
102108 comp . update ( ) . find ( Input ) . simulate ( 'blur' )
103109 expect ( comp . update ( ) . find ( 'input' ) . prop ( 'value' ) ) . to . equal ( '' )
104110 expect ( comp . update ( ) . find ( Input ) . prop ( 'meta' ) . error ) . not . to . exist
111+ expect ( getIn ( store . getState ( ) . form , [ 'form' , 'values' , 'hello' ] ) ) . to . equal ( null )
105112 } )
106113 it ( 'supports single validate function' , ( ) => {
107114 const store = createStore ( combineReducers ( { form : reducer } ) )
0 commit comments