This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -12118,6 +12118,32 @@ describe('$compile', function() {
12118
12118
expect ( element . attr ( 'dash-test4' ) ) . toBe ( 'JamieMason' ) ;
12119
12119
} ) ) ;
12120
12120
12121
+ it ( 'should work with img[src]' , inject ( function ( ) {
12122
+ $rootScope . name = 'some-image.png' ;
12123
+ element = $compile ( '<img ng-attr-src="{{name}}">' ) ( $rootScope ) ;
12124
+ expect ( element . attr ( 'src' ) ) . toBeUndefined ( ) ;
12125
+
12126
+ $rootScope . $digest ( ) ;
12127
+ expect ( element . attr ( 'src' ) ) . toBe ( 'some-image.png' ) ;
12128
+
12129
+ $rootScope . name = 'other-image.png' ;
12130
+ $rootScope . $digest ( ) ;
12131
+ expect ( element . attr ( 'src' ) ) . toBe ( 'other-image.png' ) ;
12132
+ } ) ) ;
12133
+
12134
+ it ( 'should work with img[data-src]' , inject ( function ( ) {
12135
+ $rootScope . name = 'some-image.png' ;
12136
+ element = $compile ( '<img ng-attr-data-src="{{name}}">' ) ( $rootScope ) ;
12137
+ expect ( element . attr ( 'data-src' ) ) . toBeUndefined ( ) ;
12138
+
12139
+ $rootScope . $digest ( ) ;
12140
+ expect ( element . attr ( 'data-src' ) ) . toBe ( 'some-image.png' ) ;
12141
+
12142
+ $rootScope . name = 'other-image.png' ;
12143
+ $rootScope . $digest ( ) ;
12144
+ expect ( element . attr ( 'data-src' ) ) . toBe ( 'other-image.png' ) ;
12145
+ } ) ) ;
12146
+
12121
12147
it ( 'should keep attributes ending with -start single-element directives' , function ( ) {
12122
12148
module ( function ( $compileProvider ) {
12123
12149
$compileProvider . directive ( 'dashStarter' , function ( log ) {
You can’t perform that action at this time.
0 commit comments