@@ -1273,6 +1273,11 @@ describe('FormsManager', () => {
12731273 } ) ,
12741274 } ) ;
12751275
1276+ const addressForm = new FormGroup ( {
1277+ zip : new FormControl ( '12345' ) ,
1278+ place : new FormControl ( 'Schenectady' ) ,
1279+ } ) ;
1280+
12761281 it ( 'should get and set initial Value for a control' , ( ) => {
12771282 formsManager . setInitialValue ( 'config' , 'initial' ) ;
12781283
@@ -1306,6 +1311,26 @@ describe('FormsManager', () => {
13061311 it ( 'should get undefined if no initial Value set' , ( ) => {
13071312 expect ( formsManager . getInitialValue ( 'other' ) ) . toBeUndefined ( ) ;
13081313 } ) ;
1314+
1315+ it ( 'should clear initial Value for a group of control' , ( ) => {
1316+ formsManager . upsert ( 'user' , userForm , { withInitialValue : true } ) ;
1317+ formsManager . upsert ( 'address' , addressForm , { withInitialValue : true } ) ;
1318+
1319+ formsManager . clear ( 'user' ) ;
1320+
1321+ expect ( formsManager . getInitialValue ( 'user' ) ) . toBeUndefined ( ) ;
1322+ expect ( formsManager . getInitialValue ( 'address' ) ) . toBeDefined ( ) ;
1323+ } ) ;
1324+
1325+ it ( 'should clear all initial Values when clearing full store' , ( ) => {
1326+ formsManager . upsert ( 'user' , userForm , { withInitialValue : true } ) ;
1327+ formsManager . upsert ( 'address' , addressForm , { withInitialValue : true } ) ;
1328+
1329+ formsManager . clear ( ) ;
1330+
1331+ expect ( formsManager . getInitialValue ( 'user' ) ) . toBeUndefined ( ) ;
1332+ expect ( formsManager . getInitialValue ( 'address' ) ) . toBeUndefined ( ) ;
1333+ } ) ;
13091334 } ) ;
13101335
13111336 describe ( 'Debounce' , ( ) => {
0 commit comments