8
0
فهرست منبع

Added test which verifies the number of change events fired.

Aleksander Nowodzinski 10 سال پیش
والد
کامیت
a12c9e2476
1فایلهای تغییر یافته به همراه17 افزوده شده و 0 حذف شده
  1. 17 0
      packages/ckeditor5-utils/tests/model.js

+ 17 - 0
packages/ckeditor5-utils/tests/model.js

@@ -687,6 +687,23 @@ describe( 'Model', () => {
 					}
 				);
 			} );
+
+			it( 'should fire a single change event per bound attribute', () => {
+				const vehicle = new Car();
+				const car = new Car( { color: 'red', year: 1943 } );
+				const spy = bender.sinon.spy();
+
+				vehicle.on( 'change', spy );
+
+				vehicle.bind( 'color', 'year' ).to( car );
+
+				car.color = 'violet';
+				car.custom = 'foo';
+				car.year = 2001;
+
+				expect( spy.args.map( args => args[ 1 ] ) )
+					.to.have.members( [ 'color', 'year', 'color', 'year' ] );
+			} );
 		} );
 	} );