@@ -430,7 +430,23 @@ describe('formly-form', () => {
430430 } ) ;
431431
432432 it ( 'starting with "model." should be assigned with only one watcher' , ( ) => {
433- scope . fields [ 0 ] . model = 'model.nested' ;
433+ testModelAccessor ( 'model.nested' ) ;
434+ } ) ;
435+
436+ it ( 'starting with "model[" should be assigned with only one watcher' , ( ) => {
437+ testModelAccessor ( 'model["nested"]' ) ;
438+ } ) ;
439+
440+ it ( 'starting with "formState." should be assigned with only one watcher' , ( ) => {
441+ testFormStateAccessor ( 'formState.nested' ) ;
442+ } ) ;
443+
444+ it ( 'starting with "formState[" should be assigned with only one watcher' , ( ) => {
445+ testFormStateAccessor ( 'formState["nested"]' ) ;
446+ } ) ;
447+
448+ function testModelAccessor ( accessor ) {
449+ scope . fields [ 0 ] . model = accessor ;
434450
435451 compileAndDigest ( ) ;
436452 $timeout . flush ( ) ;
@@ -442,16 +458,16 @@ describe('formly-form', () => {
442458 $timeout . flush ( ) ;
443459
444460 expect ( spy ) . to . have . been . calledOnce ;
445- } ) ;
461+ }
446462
447- it ( 'starting with "formState." should be assigned with only one watcher' , ( ) => {
463+ function testFormStateAccessor ( accessor ) {
448464 const formWithOptions = '<formly-form model="model" fields="fields" options="options"></formly-form>' ;
449465 scope . options = {
450466 formState : {
451467 nested : { }
452468 }
453469 } ;
454- scope . fields [ 0 ] . model = 'formState.nested' ;
470+ scope . fields [ 0 ] . model = accessor ;
455471
456472 compileAndDigest ( formWithOptions ) ;
457473 $timeout . flush ( ) ;
@@ -463,7 +479,7 @@ describe('formly-form', () => {
463479 $timeout . flush ( ) ;
464480
465481 expect ( spy ) . to . have . been . calledOnce ;
466- } ) ;
482+ }
467483 } ) ;
468484
469485 describe ( 'hideExpression' , ( ) => {
0 commit comments