@@ -39,19 +39,6 @@ export function main() {
3939 } ) ;
4040 } ) ;
4141
42- describe ( "pristine" , ( ) => {
43- it ( "should be true after creating a control" , ( ) => {
44- var c = new Control ( "value" ) ;
45- expect ( c . pristine ) . toEqual ( true ) ;
46- } ) ;
47-
48- it ( "should be false after changing the value of the control" , ( ) => {
49- var c = new Control ( "value" ) ;
50- c . updateValue ( "new value" ) ;
51- expect ( c . pristine ) . toEqual ( false ) ;
52- } ) ;
53- } ) ;
54-
5542 describe ( "dirty" , ( ) => {
5643 it ( "should be false after creating a control" , ( ) => {
5744 var c = new Control ( "value" ) ;
@@ -60,7 +47,7 @@ export function main() {
6047
6148 it ( "should be true after changing the value of the control" , ( ) => {
6249 var c = new Control ( "value" ) ;
63- c . updateValue ( "new value" ) ;
50+ c . markAsDirty ( ) ;
6451 expect ( c . dirty ) . toEqual ( true ) ;
6552 } ) ;
6653 } ) ;
@@ -215,20 +202,22 @@ export function main() {
215202 } ) ;
216203 } ) ;
217204
218- describe ( "pristine" , ( ) => {
219- it ( "should be true after creating a control" , ( ) => {
220- var c = new Control ( 'value' ) ;
221- var g = new ControlGroup ( { "one" : c } ) ;
205+ describe ( "dirty" , ( ) => {
206+ var c , g ;
222207
223- expect ( g . pristine ) . toEqual ( true ) ;
208+ beforeEach ( ( ) => {
209+ c = new Control ( 'value' ) ;
210+ g = new ControlGroup ( { "one" : c } ) ;
211+ } ) ;
212+
213+ it ( "should be false after creating a control" , ( ) => {
214+ expect ( g . dirty ) . toEqual ( false ) ;
224215 } ) ;
225216
226217 it ( "should be false after changing the value of the control" , ( ) => {
227- var c = new Control ( 'value' ) ;
228- var g = new ControlGroup ( { "one" : c } ) ;
229- c . updateValue ( 'new value' ) ;
218+ c . markAsDirty ( ) ;
230219
231- expect ( g . pristine ) . toEqual ( false ) ;
220+ expect ( g . dirty ) . toEqual ( true ) ;
232221 } ) ;
233222 } ) ;
234223
@@ -452,19 +441,22 @@ export function main() {
452441 } ) ;
453442 } ) ;
454443
455- describe ( "pristine" , ( ) => {
456- it ( "should be true after creating a control" , ( ) => {
457- var a = new ControlArray ( [ new Control ( 1 ) ] ) ;
458- expect ( a . pristine ) . toBe ( true ) ;
444+ describe ( "dirty" , ( ) => {
445+ var c , a ;
446+
447+ beforeEach ( ( ) => {
448+ c = new Control ( 'value' ) ;
449+ a = new ControlArray ( [ c ] ) ;
459450 } ) ;
460451
461- it ( "should be false after changing the value of the control" , ( ) => {
462- var c = new Control ( 1 ) ;
463- var a = new ControlArray ( [ c ] ) ;
452+ it ( "should be false after creating a control" , ( ) => {
453+ expect ( a . dirty ) . toEqual ( false ) ;
454+ } ) ;
464455
465- c . updateValue ( 'new value' ) ;
456+ it ( "should be false after changing the value of the control" , ( ) => {
457+ c . markAsDirty ( ) ;
466458
467- expect ( a . pristine ) . toEqual ( false ) ;
459+ expect ( a . dirty ) . toEqual ( true ) ;
468460 } ) ;
469461 } ) ;
470462
0 commit comments