@@ -11,7 +11,7 @@ import {List, MapWrapper} from 'angular2/src/facade/collection';
1111import { DOM } from 'angular2/src/dom/dom_adapter' ;
1212import { int , IMPLEMENTS } from 'angular2/src/facade/lang' ;
1313import { Injector } from 'angular2/di' ;
14- import { View } from 'angular2/src/core/compiler/view' ;
14+ import { View , PropertyUpdate } from 'angular2/src/core/compiler/view' ;
1515import { ViewContainer } from 'angular2/src/core/compiler/view_container' ;
1616import { VmTurnZone } from 'angular2/src/core/zone/vm_turn_zone' ;
1717import { EventManager , DomEventsPlugin } from 'angular2/src/core/events/event_manager' ;
@@ -601,7 +601,7 @@ export function main() {
601601 expect ( directive . c ) . toEqual ( 300 ) ;
602602 } ) ;
603603
604- it ( 'should provide a map of updated properties' , ( ) => {
604+ it ( 'should provide a map of updated properties using onChange callback ' , ( ) => {
605605 var pv = new ProtoView ( el ( '<div class="ng-binding"></div>' ) ,
606606 new DynamicProtoChangeDetector ( null ) , null ) ;
607607
@@ -612,16 +612,20 @@ export function main() {
612612 pv . bindDirectiveProperty ( 0 , parser . parseBinding ( 'b' , null ) , 'b' , reflector . setter ( 'b' ) ) ;
613613 createViewAndChangeDetector ( pv ) ;
614614
615+ var directive = view . elementInjectors [ 0 ] . get ( DirectiveImplementingOnChange ) ;
616+
615617 ctx . a = 0 ;
616618 ctx . b = 0 ;
617619 cd . detectChanges ( ) ;
618620
621+ expect ( directive . changes ) . toEqual ( {
622+ "a" : PropertyUpdate . createWithoutPrevious ( 0 ) ,
623+ "b" : PropertyUpdate . createWithoutPrevious ( 0 )
624+ } ) ;
625+
619626 ctx . a = 100 ;
620627 cd . detectChanges ( ) ;
621-
622- var directive = view . elementInjectors [ 0 ] . get ( DirectiveImplementingOnChange ) ;
623- expect ( directive . changes [ "a" ] . currentValue ) . toEqual ( 100 ) ;
624- expect ( directive . changes [ "b" ] ) . not . toBeDefined ( ) ;
628+ expect ( directive . changes ) . toEqual ( { "a" : new PropertyUpdate ( 100 , 0 ) } ) ;
625629 } ) ;
626630 } ) ;
627631 } ) ;
0 commit comments