@@ -273,6 +273,64 @@ Object.keys(testContexts).forEach((testKey) => {
273273 'forms.array.simple' ) ;
274274 } ) ;
275275 } ) ;
276+
277+ context ( 'state with empty key' , ( ) => {
278+ const emptyReducer = function ( ) { return { } ; } ;
279+ const store = createStore ( combineReducers ( {
280+ '' : emptyReducer ,
281+ firstForm : formReducer ( 'first' ) ,
282+ deep : combineReducers ( {
283+ secondForm : formReducer ( 'second' , getInitialState ( {
284+ nested : { foo : 'bar' } ,
285+ } ) ) ,
286+ deeper : combineReducers ( {
287+ thirdForm : formReducer ( 'third' ) ,
288+ } ) ,
289+ } ) ,
290+ } ) ) ;
291+
292+ it ( 'should find a shallow form reducer state key' , ( ) => {
293+ assert . equal (
294+ getFormStateKey ( store . getState ( ) , 'first' ) ,
295+ 'firstForm' ) ;
296+ } ) ;
297+
298+ it ( 'should find a shallow form reducer state key with deep model' , ( ) => {
299+ assert . equal (
300+ getFormStateKey ( store . getState ( ) , 'first.anything' ) ,
301+ 'firstForm' ) ;
302+ } ) ;
303+
304+ it ( 'should find a deep form reducer state key' , ( ) => {
305+ assert . equal (
306+ getFormStateKey ( store . getState ( ) , 'second' ) ,
307+ 'deep.secondForm' ) ;
308+ } ) ;
309+
310+ it ( 'should find a deep form reducer state key with deep model' , ( ) => {
311+ assert . equal (
312+ getFormStateKey ( store . getState ( ) , 'second.anything' ) ,
313+ 'deep.secondForm' ) ;
314+ } ) ;
315+
316+ it ( 'should find a deeper form reducer state key' , ( ) => {
317+ assert . equal (
318+ getFormStateKey ( store . getState ( ) , 'third' ) ,
319+ 'deep.deeper.thirdForm' ) ;
320+ } ) ;
321+
322+ it ( 'should find a deeper form reducer state key with deep model' , ( ) => {
323+ assert . equal (
324+ getFormStateKey ( store . getState ( ) , 'third.anything' ) ,
325+ 'deep.deeper.thirdForm' ) ;
326+ } ) ;
327+
328+ it ( 'should find a nested form reducer' , ( ) => {
329+ assert . equal (
330+ getFormStateKey ( store . getState ( ) , 'second.nested.foo' ) ,
331+ 'deep.secondForm.nested' ) ;
332+ } ) ;
333+ } ) ;
276334 } ) ;
277335
278336 describe ( 'getField()' , ( ) => {
0 commit comments