@@ -145,6 +145,55 @@ export function main() {
145145 expect ( fixture . debugElement . componentInstance . name ) . toEqual ( 'updated' ) ;
146146 } ) ) ) ;
147147
148+ it ( "should mark NgForm as submitted on submit event" ,
149+ inject ( [ TestComponentBuilder ] , fakeAsync ( ( tcb : TestComponentBuilder ) => {
150+ var t = `<div>
151+ <form #f="ngForm" (ngSubmit)="data=f.submitted"></form>
152+ <span>{{data}}</span>
153+ </div>` ;
154+
155+ var fixture : ComponentFixture < MyComp8 > ;
156+
157+ tcb . overrideTemplate ( MyComp8 , t ) . createAsync ( MyComp8 ) . then (
158+ ( root ) => { fixture = root ; } ) ;
159+ tick ( ) ;
160+
161+ fixture . debugElement . componentInstance . data = false ;
162+
163+ tick ( ) ;
164+
165+ var form = fixture . debugElement . query ( By . css ( "form" ) ) ;
166+ dispatchEvent ( form . nativeElement , "submit" ) ;
167+
168+ tick ( ) ;
169+ expect ( fixture . debugElement . componentInstance . data ) . toEqual ( true ) ;
170+ } ) ) ) ;
171+
172+ it ( "should mark NgFormModel as submitted on submit event" ,
173+ inject ( [ TestComponentBuilder ] , fakeAsync ( ( tcb : TestComponentBuilder ) => {
174+ var t = `<div>
175+ <form #f="ngForm" [ngFormModel]="form" (ngSubmit)="data=f.submitted"></form>
176+ <span>{{data}}</span>
177+ </div>` ;
178+
179+ var fixture : ComponentFixture < MyComp8 > ;
180+
181+ tcb . overrideTemplate ( MyComp8 , t ) . createAsync ( MyComp8 ) . then (
182+ ( root ) => { fixture = root ; } ) ;
183+ tick ( ) ;
184+
185+ fixture . debugElement . componentInstance . form = new ControlGroup ( { } ) ;
186+ fixture . debugElement . componentInstance . data = false ;
187+
188+ tick ( ) ;
189+
190+ var form = fixture . debugElement . query ( By . css ( "form" ) ) ;
191+ dispatchEvent ( form . nativeElement , "submit" ) ;
192+
193+ tick ( ) ;
194+ expect ( fixture . debugElement . componentInstance . data ) . toEqual ( true ) ;
195+ } ) ) ) ;
196+
148197 it ( "should work with single controls" ,
149198 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
150199 var control = new Control ( "loginValue" ) ;
0 commit comments