@@ -372,6 +372,46 @@ describe('ngMessages', function() {
372
372
expect ( trim ( element . text ( ) ) ) . toEqual ( "Enter something" ) ;
373
373
} ) ) ;
374
374
375
+
376
+ iit ( 'should work with ngBind' ,
377
+ inject ( function ( $rootScope , $compile ) {
378
+
379
+ element = $compile ( '<div ng-messages="col">' +
380
+ ' <div ng-message="required" ng-bind="errorMessages.required"></div>' +
381
+ ' <div ng-message="extra" ng-bind="errorMessages.extra"></div>' +
382
+ '</div>' ) ( $rootScope ) ;
383
+
384
+ $rootScope . $apply ( function ( ) {
385
+ $rootScope . col = {
386
+ required : true ,
387
+ extra : true
388
+ } ;
389
+ $rootScope . errorMessages = {
390
+ required : 'Fill in the text field.' ,
391
+ extra : 'Extra error message.'
392
+ } ;
393
+ } ) ;
394
+
395
+ expect ( messageChildren ( element ) . length ) . toBe ( 1 ) ;
396
+ expect ( trim ( element . text ( ) ) ) . toEqual ( 'Fill in the text field.' ) ;
397
+
398
+ $rootScope . $apply ( function ( ) {
399
+ $rootScope . col . required = false ;
400
+ $rootScope . col . extra = true ;
401
+ } ) ;
402
+
403
+ expect ( messageChildren ( element ) . length ) . toBe ( 1 ) ;
404
+ expect ( trim ( element . text ( ) ) ) . toEqual ( 'Extra error message.' ) ;
405
+
406
+ $rootScope . $apply ( function ( ) {
407
+ $rootScope . errorMessages . extra = 'New error message.' ;
408
+ } ) ;
409
+
410
+ expect ( messageChildren ( element ) . length ) . toBe ( 1 ) ;
411
+ expect ( trim ( element . text ( ) ) ) . toEqual ( 'New error message.' ) ;
412
+ } ) ) ;
413
+
414
+
375
415
// issue #12856
376
416
it ( 'should only detach the message object that is associated with the message node being removed' ,
377
417
inject ( function ( $rootScope , $compile , $animate ) {
0 commit comments