Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 5839dce

Browse files
rjametNarretz
authored andcommitted
fix($compileSpec): disable older msie for the video test and sort tests.
Older msies reject my video element test, and format things better, no more tests for video[src] contexts under a img[src] sanitization describe.
1 parent ff090d7 commit 5839dce

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

test/ng/compileSpec.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10138,8 +10138,7 @@ describe('$compile', function() {
1013810138
});
1013910139
});
1014010140

10141-
10142-
describe('img[src] sanitization', function() {
10141+
describe('*[src] context requirement', function() {
1014310142

1014410143
it('should NOT require trusted values for img src', inject(function($rootScope, $compile, $sce) {
1014510144
element = $compile('<img src="{{testUrl}}"></img>')($rootScope);
@@ -10152,17 +10151,24 @@ describe('$compile', function() {
1015210151
expect(element.attr('src')).toEqual('http://example.com/image2.png');
1015310152
}));
1015410153

10155-
it('should NOT require trusted values for video / audio / track src', inject(function($rootScope, $compile, $sce) {
10156-
element = $compile('<video src="{{testUrl}}"></video>')($rootScope);
10157-
$rootScope.testUrl = 'http://example.com/image.mp4';
10158-
$rootScope.$digest();
10159-
expect(element.attr('src')).toEqual('http://example.com/image.mp4');
10154+
// Older IEs seem to reject the video tag with "Error: Not implemented"
10155+
if (!msie || msie > 9) {
10156+
it('should NOT require trusted values for video src',
10157+
inject(function($rootScope, $compile, $sce) {
10158+
element = $compile('<video src="{{testUrl}}"></video>')($rootScope);
10159+
$rootScope.testUrl = 'http://example.com/image.mp4';
10160+
$rootScope.$digest();
10161+
expect(element.attr('src')).toEqual('http://example.com/image.mp4');
1016010162

10161-
// But it should accept trusted values anyway.
10162-
$rootScope.testUrl = $sce.trustAsUrl('http://example.com/image2.mp4');
10163-
$rootScope.$digest();
10164-
expect(element.attr('src')).toEqual('http://example.com/image2.mp4');
10165-
}));
10163+
// But it should accept trusted values anyway.
10164+
$rootScope.testUrl = $sce.trustAsUrl('http://example.com/image2.mp4');
10165+
$rootScope.$digest();
10166+
expect(element.attr('src')).toEqual('http://example.com/image2.mp4');
10167+
}));
10168+
}
10169+
});
10170+
10171+
describe('img[src] sanitization', function() {
1016610172

1016710173
it('should not sanitize attributes other than src', inject(function($compile, $rootScope) {
1016810174
element = $compile('<img title="{{testUrl}}"></img>')($rootScope);

0 commit comments

Comments
 (0)