@@ -745,7 +745,7 @@ $(document).ready(function() {
745
745
model . set ( { y : true } ) ;
746
746
} ) ;
747
747
model . set ( { x : true } ) ;
748
- deepEqual ( events , [ 'change:y' , 'change:x' , 'change' , 'change' ] ) ;
748
+ deepEqual ( events , [ 'change:y' , 'change:x' , 'change' ] ) ;
749
749
events = [ ] ;
750
750
model . set ( { z : true } ) ;
751
751
deepEqual ( events , [ ] ) ;
@@ -786,7 +786,7 @@ $(document).ready(function() {
786
786
model . set ( { x : true } ) ;
787
787
} ) ;
788
788
789
- test ( "nested `' change' ` with silent" , 3 , function ( ) {
789
+ test ( "nested `change` with silent" , 3 , function ( ) {
790
790
var count = 0 ;
791
791
var model = new Backbone . Model ( ) ;
792
792
model . on ( 'change:y' , function ( ) { ok ( false ) ; } ) ;
@@ -795,22 +795,23 @@ $(document).ready(function() {
795
795
case 0 :
796
796
deepEqual ( this . changedAttributes ( ) , { x : true } ) ;
797
797
model . set ( { y : true } , { silent : true } ) ;
798
+ model . set ( { z : true } ) ;
798
799
break ;
799
800
case 1 :
800
- deepEqual ( this . changedAttributes ( ) , { x : true , y : true } ) ;
801
+ deepEqual ( this . changedAttributes ( ) , { x : true , y : true , z : true } ) ;
801
802
break ;
802
803
case 2 :
803
- deepEqual ( this . changedAttributes ( ) , { z : true } ) ;
804
+ deepEqual ( this . changedAttributes ( ) , { z : false } ) ;
804
805
break ;
805
806
default :
806
807
ok ( false ) ;
807
808
}
808
809
} ) ;
809
810
model . set ( { x : true } ) ;
810
- model . set ( { z : true } ) ;
811
+ model . set ( { z : false } ) ;
811
812
} ) ;
812
813
813
- test ( "nested `' change:attr' ` with silent" , 0 , function ( ) {
814
+ test ( "nested `change:attr` with silent" , 0 , function ( ) {
814
815
var model = new Backbone . Model ( ) ;
815
816
model . on ( 'change:y' , function ( ) { ok ( false ) ; } ) ;
816
817
model . on ( 'change' , function ( ) {
@@ -1053,4 +1054,13 @@ $(document).ready(function() {
1053
1054
model . save ( { x : 1 } , { wait : true } ) ;
1054
1055
} ) ;
1055
1056
1057
+ test ( "#2034 - nested set with silent only triggers one change" , 1 , function ( ) {
1058
+ var model = new Backbone . Model ( ) ;
1059
+ model . on ( 'change' , function ( ) {
1060
+ model . set ( { b : true } , { silent : true } ) ;
1061
+ ok ( true ) ;
1062
+ } ) ;
1063
+ model . set ( { a : true } ) ;
1064
+ } ) ;
1065
+
1056
1066
} ) ;
0 commit comments