From ec3c4f94c79e23c29abcde6e1d2f6eaf05e0664c Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 19 Nov 2013 20:42:38 -0800 Subject: refactor($sce): Use $sniffer instead of $document for feature detection. Also adds `$sniffer.msieDocumentMode` property. Closes #4931 Closes #5045 --- test/ng/sceSpecs.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'test/ng/sceSpecs.js') 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 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 to ' + + 'the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more ' + + 'information.'); + } else { + // no exception. + constructSce(); } }); } -- cgit v1.2.3