diff options
| author | Chirayu Krishnappa | 2013-10-02 11:10:04 -0700 | 
|---|---|---|
| committer | Chirayu Krishnappa | 2013-10-02 12:06:27 -0700 | 
| commit | 78a5889bc691d95e5b037c99de3607f02a69a188 (patch) | |
| tree | 23baba6ecefe9525006ac5ece3fc8679756e40cc /test | |
| parent | 10cc1a42c925749f88433546d41d35ba07a88e6f (diff) | |
| download | angular.js-78a5889bc691d95e5b037c99de3607f02a69a188.tar.bz2 | |
test($sce): ie8 fix for entire file
Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813
Closes #4221
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/sceSpecs.js | 31 | 
1 files changed, 14 insertions, 17 deletions
| diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js index 6c814e7e..e1588fe2 100644 --- a/test/ng/sceSpecs.js +++ b/test/ng/sceSpecs.js @@ -2,6 +2,12 @@  describe('SCE', function() { +  // Work around an IE8 bug.  Though window.inject === angular.mock.inject, if it's invoked the +  // window scope, IE8 loses the exception object that bubbles up and replaces it with a TypeError. +  // By using a local alias, it gets invoked on the global scope instead of window. +  // Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813 +  var inject = angular.mock.inject; +    describe('when disabled', function() {      beforeEach(function() {        module(function($sceProvider) { @@ -262,9 +268,7 @@ describe('SCE', function() {              $sceDelegateProvider.resourceUrlBlacklist(cfg.blackList);            }          }); -        // This needs to be angular.mock.inject even though it's === window.inject. -        // Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813 -        angular.mock.inject(testFn); +        inject(testFn);        }      } @@ -399,20 +403,13 @@ describe('SCE', function() {            expect($sce.getTrustedResourceUrl('http://example.com/foo:1/2.3?4&5-6')).toEqual('http://example.com/foo:1/2.3?4&5-6');        })); -      // TODO(chirayu): This throws a very helpful TypeError exception - "Object doesn't support -      // this property or method".  Tracing using the debugger on IE8 developer tools shows me one -      // catch(e) block where the exception is correct, but jumping up to the parent catch block has -      // the TypeError exception.  I've been unable to repro this outside this snippet or figure out -      // why this is happening.  Until then, this test doesn't run on IE8. -      if (!msie || msie > 8) { -        it('should not accept *** in the string', function() { -          expect(function() { -            runTest({whiteList: ['http://***']}, null)(); -          }).toThrowMinErr('$injector', 'modulerr', new RegExp( -               /Failed to instantiate module function ?\(\$sceDelegateProvider\) due to:\n/.source + -               /[^[]*\[\$sce:iwcard\] Illegal sequence \*\*\* in string matcher\.  String: http:\/\/\*\*\*/.source)); -        }); -      } +      it('should not accept *** in the string', function() { +        expect(function() { +          runTest({whiteList: ['http://***']}, null)(); +        }).toThrowMinErr('$injector', 'modulerr', new RegExp( +             /Failed to instantiate module function ?\(\$sceDelegateProvider\) due to:\n/.source + +             /[^[]*\[\$sce:iwcard\] Illegal sequence \*\*\* in string matcher\.  String: http:\/\/\*\*\*/.source)); +      });      });      describe('"self" matcher', function() { | 
