From affcbad501ad5e17b8cb30ad8a2c0d1de6686722 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Mon, 6 Jan 2014 19:08:05 -0800 Subject: [PATCH] test(ngMock): fix the tests to not use global msie My bad when merging 7e916455b36dc9ca4d4afc1e44cade90006d00e3. These tests are run with compiled Angular and then the msie is not defined. --- test/ngMock/angular-mocksSpec.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js index 6c096471..fb602adc 100644 --- a/test/ngMock/angular-mocksSpec.js +++ b/test/ngMock/angular-mocksSpec.js @@ -863,22 +863,30 @@ describe('ngMock', function() { }); }); + // We don't run the following tests on IE8. // IE8 throws "Object does not support this property or method." error, // when thrown from a function defined on window (which `inject` is). - if (msie <= 8) return; - it('should not change thrown Errors', function() { - expect(function(){ - throw new Error('test message'); - }).toThrow('test message'); - }); + it('should not change thrown Errors', inject(function($sniffer) { + if ($sniffer.msie <= 8) return; - it('should not change thrown strings', function(){ - expect(function(){ - throw 'test message'; + expect(function() { + inject(function() { + throw new Error('test message'); + }); }).toThrow('test message'); - }); + })); + + it('should not change thrown strings', inject(function($sniffer) { + if ($sniffer.msie <= 8) return; + + expect(function() { + inject(function() { + throw 'test message'; + }); + }).toThrow('test message'); + })); }); });