@@ -12093,32 +12093,8 @@ describe('$compile', function() {
12093
12093
expect ( element . attr ( 'test6' ) ) . toBe ( 'Misko' ) ;
12094
12094
} ) ) ;
12095
12095
12096
- describe ( 'when an attribute has a dash-separated name' , function ( ) {
12097
- it ( 'should work with different prefixes' , inject ( function ( ) {
12098
- $rootScope . name = 'JamieMason' ;
12099
- element = $compile ( '<span ng:attr:dash-test="{{name}}" ng-Attr-dash-test2="{{name}}" ng_Attr_dash-test3="{{name}}"></span>' ) ( $rootScope ) ;
12100
- expect ( element . attr ( 'dash-test' ) ) . toBeUndefined ( ) ;
12101
- expect ( element . attr ( 'dash-test2' ) ) . toBeUndefined ( ) ;
12102
- expect ( element . attr ( 'dash-test3' ) ) . toBeUndefined ( ) ;
12103
- $rootScope . $digest ( ) ;
12104
- expect ( element . attr ( 'dash-test' ) ) . toBe ( 'JamieMason' ) ;
12105
- expect ( element . attr ( 'dash-test2' ) ) . toBe ( 'JamieMason' ) ;
12106
- expect ( element . attr ( 'dash-test3' ) ) . toBe ( 'JamieMason' ) ;
12107
- } ) ) ;
12108
-
12109
- it ( 'should work if they are prefixed with x- or data-' , inject ( function ( ) {
12110
- $rootScope . name = 'JamieMason' ;
12111
- element = $compile ( '<span data-ng-attr-dash-test2="{{name}}" x-ng-attr-dash-test3="{{name}}" data-ng:attr-dash-test4="{{name}}"></span>' ) ( $rootScope ) ;
12112
- expect ( element . attr ( 'dash-test2' ) ) . toBeUndefined ( ) ;
12113
- expect ( element . attr ( 'dash-test3' ) ) . toBeUndefined ( ) ;
12114
- expect ( element . attr ( 'dash-test4' ) ) . toBeUndefined ( ) ;
12115
- $rootScope . $digest ( ) ;
12116
- expect ( element . attr ( 'dash-test2' ) ) . toBe ( 'JamieMason' ) ;
12117
- expect ( element . attr ( 'dash-test3' ) ) . toBe ( 'JamieMason' ) ;
12118
- expect ( element . attr ( 'dash-test4' ) ) . toBe ( 'JamieMason' ) ;
12119
- } ) ) ;
12120
-
12121
- it ( 'should work with img[src]' , inject ( function ( ) {
12096
+ describe ( 'with media url attributes' , function ( ) {
12097
+ it ( 'should work with interpolated ng-attr-src' , inject ( function ( ) {
12122
12098
$rootScope . name = 'some-image.png' ;
12123
12099
element = $compile ( '<img ng-attr-src="{{name}}">' ) ( $rootScope ) ;
12124
12100
expect ( element . attr ( 'src' ) ) . toBeUndefined ( ) ;
@@ -12131,7 +12107,7 @@ describe('$compile', function() {
12131
12107
expect ( element . attr ( 'src' ) ) . toBe ( 'other-image.png' ) ;
12132
12108
} ) ) ;
12133
12109
12134
- it ( 'should work with img[ data-src] ' , inject ( function ( ) {
12110
+ it ( 'should work with interpolated ng-attr- data-src' , inject ( function ( ) {
12135
12111
$rootScope . name = 'some-image.png' ;
12136
12112
element = $compile ( '<img ng-attr-data-src="{{name}}">' ) ( $rootScope ) ;
12137
12113
expect ( element . attr ( 'data-src' ) ) . toBeUndefined ( ) ;
@@ -12144,7 +12120,7 @@ describe('$compile', function() {
12144
12120
expect ( element . attr ( 'data-src' ) ) . toBe ( 'other-image.png' ) ;
12145
12121
} ) ) ;
12146
12122
12147
- it ( 'should compile img with constant [src]-attribute and [ng-attr-data-src] attribute ' , inject ( function ( ) {
12123
+ it ( 'should work alongside constant [src]-attribute and [ng-attr-data-src] attributes ' , inject ( function ( ) {
12148
12124
$rootScope . name = 'some-image.png' ;
12149
12125
element = $compile ( '<img src="constant.png" ng-attr-data-src="{{name}}">' ) ( $rootScope ) ;
12150
12126
expect ( element . attr ( 'data-src' ) ) . toBeUndefined ( ) ;
@@ -12158,6 +12134,32 @@ describe('$compile', function() {
12158
12134
expect ( element . attr ( 'src' ) ) . toBe ( 'constant.png' ) ;
12159
12135
expect ( element . attr ( 'data-src' ) ) . toBe ( 'other-image.png' ) ;
12160
12136
} ) ) ;
12137
+ } ) ;
12138
+
12139
+ describe ( 'when an attribute has a dash-separated name' , function ( ) {
12140
+ it ( 'should work with different prefixes' , inject ( function ( ) {
12141
+ $rootScope . name = 'JamieMason' ;
12142
+ element = $compile ( '<span ng:attr:dash-test="{{name}}" ng-Attr-dash-test2="{{name}}" ng_Attr_dash-test3="{{name}}"></span>' ) ( $rootScope ) ;
12143
+ expect ( element . attr ( 'dash-test' ) ) . toBeUndefined ( ) ;
12144
+ expect ( element . attr ( 'dash-test2' ) ) . toBeUndefined ( ) ;
12145
+ expect ( element . attr ( 'dash-test3' ) ) . toBeUndefined ( ) ;
12146
+ $rootScope . $digest ( ) ;
12147
+ expect ( element . attr ( 'dash-test' ) ) . toBe ( 'JamieMason' ) ;
12148
+ expect ( element . attr ( 'dash-test2' ) ) . toBe ( 'JamieMason' ) ;
12149
+ expect ( element . attr ( 'dash-test3' ) ) . toBe ( 'JamieMason' ) ;
12150
+ } ) ) ;
12151
+
12152
+ it ( 'should work if they are prefixed with x- or data-' , inject ( function ( ) {
12153
+ $rootScope . name = 'JamieMason' ;
12154
+ element = $compile ( '<span data-ng-attr-dash-test2="{{name}}" x-ng-attr-dash-test3="{{name}}" data-ng:attr-dash-test4="{{name}}"></span>' ) ( $rootScope ) ;
12155
+ expect ( element . attr ( 'dash-test2' ) ) . toBeUndefined ( ) ;
12156
+ expect ( element . attr ( 'dash-test3' ) ) . toBeUndefined ( ) ;
12157
+ expect ( element . attr ( 'dash-test4' ) ) . toBeUndefined ( ) ;
12158
+ $rootScope . $digest ( ) ;
12159
+ expect ( element . attr ( 'dash-test2' ) ) . toBe ( 'JamieMason' ) ;
12160
+ expect ( element . attr ( 'dash-test3' ) ) . toBe ( 'JamieMason' ) ;
12161
+ expect ( element . attr ( 'dash-test4' ) ) . toBe ( 'JamieMason' ) ;
12162
+ } ) ) ;
12161
12163
12162
12164
it ( 'should keep attributes ending with -start single-element directives' , function ( ) {
12163
12165
module ( function ( $compileProvider ) {
0 commit comments