@@ -986,71 +986,6 @@ describe("Scope", () => {
986986
987987 expect ( spy ) . not . toHaveBeenCalled ( ) ;
988988 } ) ;
989-
990- it ( "deregisters repeated watch keys only once" , async ( ) => {
991- const spy = jasmine . createSpy ( "repeated watch" ) ;
992- scope . a = 1 ;
993-
994- const unwatch = scope . $watch ( "a + a" , spy ) ;
995-
996- await wait ( ) ;
997- expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
998- spy . calls . reset ( ) ;
999-
1000- /** @type {Function } */ ( unwatch ) ( ) ;
1001- scope . a = 2 ;
1002- await wait ( ) ;
1003-
1004- expect ( spy ) . not . toHaveBeenCalled ( ) ;
1005- } ) ;
1006-
1007- it ( "does not trigger twice for repeated array expression keys" , async ( ) => {
1008- const spy = jasmine . createSpy ( "repeated array watch" ) ;
1009- scope . a = 1 ;
1010-
1011- scope . $watch ( "[a, a]" , spy ) ;
1012-
1013- await wait ( ) ;
1014- expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
1015- spy . calls . reset ( ) ;
1016-
1017- scope . a = 2 ;
1018- await wait ( ) ;
1019-
1020- expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
1021- expect ( spy . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( [ 2 , 2 ] ) ;
1022- } ) ;
1023-
1024- it ( "does not trigger twice for repeated object expression keys and deregisters cleanly" , async ( ) => {
1025- const spy = jasmine . createSpy ( "repeated object watch" ) ;
1026- scope . a = 1 ;
1027-
1028- const unwatch = scope . $watch ( "{left: a, right: a}" , spy ) ;
1029-
1030- await wait ( ) ;
1031- expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
1032- expect ( spy . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( {
1033- left : 1 ,
1034- right : 1 ,
1035- } ) ;
1036- spy . calls . reset ( ) ;
1037-
1038- scope . a = 2 ;
1039- await wait ( ) ;
1040-
1041- expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
1042- expect ( spy . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( {
1043- left : 2 ,
1044- right : 2 ,
1045- } ) ;
1046- spy . calls . reset ( ) ;
1047-
1048- /** @type {Function } */ ( unwatch ) ( ) ;
1049- scope . a = 3 ;
1050- await wait ( ) ;
1051-
1052- expect ( spy ) . not . toHaveBeenCalled ( ) ;
1053- } ) ;
1054989 } ) ;
1055990
1056991 describe ( "apply expression" , ( ) => {
@@ -1360,25 +1295,6 @@ describe("Scope", () => {
13601295 expect ( count ) . toEqual ( 3 ) ;
13611296 } ) ;
13621297
1363- it ( "does not register duplicate listeners for repeated watch keys" , async ( ) => {
1364- scope . counter = 0 ;
1365- scope . a = 1 ;
1366-
1367- scope . $watch ( "a + a" , ( ) => {
1368- scope . counter ++ ;
1369- } ) ;
1370- await wait ( ) ;
1371- expect ( scope . counter ) . toBe ( 1 ) ;
1372-
1373- scope . a = 2 ;
1374- await wait ( ) ;
1375- expect ( scope . counter ) . toBe ( 2 ) ;
1376-
1377- scope . a = 3 ;
1378- await wait ( ) ;
1379- expect ( scope . counter ) . toBe ( 3 ) ;
1380- } ) ;
1381-
13821298 it ( "calls the listener function when a deeply nested watched value changes" , async ( ) => {
13831299 scope . counter = 0 ;
13841300 scope . someValue = { b : { c : { d : 1 } } } ;
0 commit comments