@@ -11395,15 +11395,14 @@ describe('$compile', function() {
11395
11395
}));
11396
11396
11397
11397
it('should use $$sanitizeUri', function() {
11398
- var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri');
11398
+ var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri').and.returnValue('someSanitizedUrl') ;
11399
11399
module(function($provide) {
11400
11400
$provide.value('$$sanitizeUri', $$sanitizeUri);
11401
11401
});
11402
11402
inject(function($compile, $rootScope) {
11403
11403
element = $compile('<img src="{{testUrl}}"></img>')($rootScope);
11404
11404
$rootScope.testUrl = 'someUrl';
11405
11405
11406
- $$sanitizeUri.and.returnValue('someSanitizedUrl');
11407
11406
$rootScope.$apply();
11408
11407
expect(element.attr('src')).toBe('someSanitizedUrl');
11409
11408
expect($$sanitizeUri).toHaveBeenCalledWith($rootScope.testUrl, true);
@@ -11480,7 +11479,7 @@ describe('$compile', function() {
11480
11479
expect(element.attr('srcset')).toEqual('http://example.com');
11481
11480
}));
11482
11481
11483
- it('does not work with trusted values', inject(function($rootScope, $compile, $sce) {
11482
+ it('should NOT work with trusted values', inject(function($rootScope, $compile, $sce) {
11484
11483
// A limitation of the approach used for srcset is that you cannot use `trustAsUrl`.
11485
11484
// Use trustAsHtml and ng-bind-html to work around this.
11486
11485
element = $compile('<img srcset="{{testUrl}}"></img>')($rootScope);
@@ -11830,7 +11829,7 @@ describe('$compile', function() {
11830
11829
}));
11831
11830
11832
11831
11833
- it('should pass through $sce.trustAs () values in action attribute', inject(function($compile, $rootScope, $sce) {
11832
+ it('should pass through $sce.trustAsResourceUrl () values in action attribute', inject(function($compile, $rootScope, $sce) {
11834
11833
element = $compile('<form action="{{testUrl}}"></form>')($rootScope);
11835
11834
$rootScope.testUrl = $sce.trustAsResourceUrl('javascript:doTrustedStuff()');
11836
11835
$rootScope.$apply();
@@ -12046,7 +12045,7 @@ describe('$compile', function() {
12046
12045
expect(attrs.ngAttrSuperTitle).toBeUndefined();
12047
12046
expect(attrs.$attr.ngAttrSuperTitle).toBeUndefined();
12048
12047
12049
- //Note the casing is incorrect: https://github.com/angular/angular.js/issues/16624
12048
+ // Note the casing is incorrect: https://github.com/angular/angular.js/issues/16624
12050
12049
expect(attrs.myCameltitle).toBe('56');
12051
12050
expect(attrs.$attr.myCameltitle).toBe('my-camelTitle');
12052
12051
expect(attrs.ngAttrMyCameltitle).toBeUndefined();
@@ -12163,14 +12162,11 @@ describe('$compile', function() {
12163
12162
12164
12163
it('should call the listener synchronously', inject(function($compile, $rootScope) {
12165
12164
element = $compile('<span ng-on-foo="fooEvent()"></span>')($rootScope);
12166
- $rootScope.fooEvent = jasmine.createSpy('fooEvent').and.callFake(function() {
12167
- $rootScope.value = 'newValue';
12168
- });
12165
+ $rootScope.fooEvent = jasmine.createSpy('fooEvent');
12169
12166
12170
12167
element.triggerHandler('foo');
12171
12168
12172
12169
expect($rootScope.fooEvent).toHaveBeenCalledOnce();
12173
- expect($rootScope.value).toBe('newValue');
12174
12170
}));
12175
12171
12176
12172
it('should support multiple events on a single element', inject(function($compile, $rootScope) {
@@ -12262,7 +12258,7 @@ describe('$compile', function() {
12262
12258
$rootScope.value = 'test';
12263
12259
element = $compile('<a ng-prop-href="\'test/\' + value"></a>')($rootScope);
12264
12260
$rootScope.$digest();
12265
- expect(element.prop('href').slice(-'/test /test'.length)).toBe(' /test/test' );
12261
+ expect(element.prop('href')).toMatch(/\ /test\ /test$/ );
12266
12262
}));
12267
12263
12268
12264
it('should work if they are prefixed with x- or data- and different prefixes', inject(function($rootScope, $compile) {
@@ -12309,7 +12305,7 @@ describe('$compile', function() {
12309
12305
});
12310
12306
inject(function($compile, $rootScope) {
12311
12307
$compile('<div attr-exposer ng-prop-title="12" ng-prop-super-title="34" ng-prop-my-camel_title="56">')($rootScope);
12312
- $rootScope.$apply ();
12308
+ $rootScope.$digest ();
12313
12309
12314
12310
expect(attrs.title).toBeUndefined();
12315
12311
expect(attrs.$attr.title).toBeUndefined();
@@ -12348,7 +12344,6 @@ describe('$compile', function() {
12348
12344
12349
12345
it('should disallow property binding to onclick', inject(function($compile, $rootScope) {
12350
12346
// All event prop bindings are disallowed.
12351
- $rootScope.onClickJs = function() {};
12352
12347
expect(function() {
12353
12348
$compile('<button ng-prop-onclick="onClickJs"></script>');
12354
12349
}).toThrowMinErr(
@@ -12491,15 +12486,14 @@ describe('$compile', function() {
12491
12486
}));
12492
12487
12493
12488
it('should use $$sanitizeUri', function() {
12494
- var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri');
12489
+ var $$sanitizeUri = jasmine.createSpy('$$sanitizeUri').and.returnValue('someSanitizedUrl') ;
12495
12490
module(function($provide) {
12496
12491
$provide.value('$$sanitizeUri', $$sanitizeUri);
12497
12492
});
12498
12493
inject(function($compile, $rootScope) {
12499
12494
element = $compile('<img ng-prop-src="testUrl"></img>')($rootScope);
12500
12495
$rootScope.testUrl = 'someUrl';
12501
12496
12502
- $$sanitizeUri.and.returnValue('someSanitizedUrl');
12503
12497
$rootScope.$apply();
12504
12498
expect(element.prop('src')).toMatch(/^http:\/\/.*\/someSanitizedUrl$/);
12505
12499
expect($$sanitizeUri).toHaveBeenCalledWith($rootScope.testUrl, true);
@@ -12524,14 +12518,14 @@ describe('$compile', function() {
12524
12518
12525
12519
['img', 'source'].forEach(function(srcsetElement) {
12526
12520
describe(srcsetElement + '[srcset] sanitization', function() {
12527
- it('should not error if srcset is undefined ', inject(function($compile, $rootScope) {
12521
+ it('should not error if srcset is blank ', inject(function($compile, $rootScope) {
12528
12522
element = $compile('<' + srcsetElement + ' ng-prop-srcset="testUrl"></' + srcsetElement + '>')($rootScope);
12529
12523
// Set srcset to a value
12530
12524
$rootScope.testUrl = 'http://example.com/';
12531
12525
$rootScope.$digest();
12532
12526
expect(element.prop('srcset')).toBe('http://example.com/');
12533
12527
12534
- // Now set it to undefined
12528
+ // Now set it to blank
12535
12529
$rootScope.testUrl = '';
12536
12530
$rootScope.$digest();
12537
12531
expect(element.prop('srcset')).toBe('');
@@ -12551,7 +12545,7 @@ describe('$compile', function() {
12551
12545
expect(element.prop('srcset')).toEqual('http://example.com');
12552
12546
}));
12553
12547
12554
- it('does not work with trusted values', inject(function($rootScope, $compile, $sce) {
12548
+ it('should NOT work with trusted values', inject(function($rootScope, $compile, $sce) {
12555
12549
// A limitation of the approach used for srcset is that you cannot use `trustAsUrl`.
12556
12550
// Use trustAsHtml and ng-bind-html to work around this.
12557
12551
element = $compile('<' + srcsetElement + ' ng-prop-srcset="testUrl"></' + srcsetElement + '>')($rootScope);
@@ -12806,7 +12800,7 @@ describe('$compile', function() {
12806
12800
}));
12807
12801
12808
12802
12809
- it('should pass through $sce.trustAs () values in action property', inject(function($compile, $rootScope, $sce) {
12803
+ it('should pass through $sce.trustAsResourceUrl () values in action property', inject(function($compile, $rootScope, $sce) {
12810
12804
element = $compile('<form ng-prop-action="testUrl"></form>')($rootScope);
12811
12805
$rootScope.testUrl = $sce.trustAsResourceUrl('javascript:doTrustedStuff()');
12812
12806
$rootScope.$apply();
@@ -12983,7 +12977,7 @@ describe('$compile', function() {
12983
12977
describe('addPropertySecurityContext', function() {
12984
12978
function testProvider(provider) {
12985
12979
module(provider);
12986
- inject(function($compile) { /* done! */});
12980
+ inject(function($compile) { /* done! */ });
12987
12981
}
12988
12982
12989
12983
it('should allow adding new properties', function() {
0 commit comments