diff options
Diffstat (limited to 'test/ng')
| -rw-r--r-- | test/ng/sceSpecs.js | 33 | ||||
| -rw-r--r-- | test/ng/snifferSpec.js | 5 |
2 files changed, 18 insertions, 20 deletions
diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js index e1588fe2..66c05c0d 100644 --- a/test/ng/sceSpecs.js +++ b/test/ng/sceSpecs.js @@ -29,10 +29,10 @@ describe('SCE', function() { describe('IE8 quirks mode', function() { function runTest(enabled, documentMode, expectException) { module(function($provide) { - $provide.value('$document', [{ - documentMode: documentMode, - createElement: function() {} - }]); + $provide.value('$sniffer', { + msie: documentMode, + msieDocumentMode: documentMode + }); $provide.value('$sceDelegate', {trustAs: null, valueOf: null, getTrusted: null}); }); @@ -43,22 +43,15 @@ describe('SCE', function() { return $injector.invoke(sceProvider.$get, sceProvider); } - var origMsie = $window.msie; - try { - $window.msie = true; - if (expectException) { - expect(constructSce).toThrowMinErr( - '$sce', 'iequirks', 'Strict Contextual Escaping does not support Internet Explorer ' + - 'version < 9 in quirks mode. You can fix this by adding the text <!doctype html> to ' + - 'the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more ' + - 'information.'); - } else { - // no exception. - constructSce(); - } - } - finally { - $window.msie = origMsie; + if (expectException) { + expect(constructSce).toThrowMinErr( + '$sce', 'iequirks', 'Strict Contextual Escaping does not support Internet Explorer ' + + 'version < 9 in quirks mode. You can fix this by adding the text <!doctype html> to ' + + 'the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more ' + + 'information.'); + } else { + // no exception. + constructSce(); } }); } diff --git a/test/ng/snifferSpec.js b/test/ng/snifferSpec.js index 9ab317d2..24e0584b 100644 --- a/test/ng/snifferSpec.js +++ b/test/ng/snifferSpec.js @@ -337,4 +337,9 @@ describe('$sniffer', function() { it('should return true for msie when internet explorer is being used', inject(function($sniffer) { expect($sniffer.msie > 0).toBe(window.navigator.appName == 'Microsoft Internet Explorer'); })); + + it('should return document.documentMode as msieDocumentMode', function() { + var someDocumentMode = 123; + expect(sniffer({}, {documentMode: someDocumentMode}).msieDocumentMode).toBe(someDocumentMode); + }); }); |
