aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/scriptSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2012-04-17 13:55:10 -0700
committerMisko Hevery2012-04-20 11:29:34 -0700
commit94dd68570952f6f31abfa351b1159afcd3588a57 (patch)
treedcc20e15f9a32f55d8b97dc67489cc6c3a116930 /test/ng/directive/scriptSpec.js
parentdc32ea627e38b34ecdb709fce0cf34134d12193e (diff)
downloadangular.js-94dd68570952f6f31abfa351b1159afcd3588a57.tar.bz2
fix(script): Incorrectly reading script text on ie
IE deals with script tags in special way and .text() does not work. Reading the .text property directly fixes the issue.
Diffstat (limited to 'test/ng/directive/scriptSpec.js')
-rw-r--r--test/ng/directive/scriptSpec.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/test/ng/directive/scriptSpec.js b/test/ng/directive/scriptSpec.js
index 471e04ce..73128765 100644
--- a/test/ng/directive/scriptSpec.js
+++ b/test/ng/directive/scriptSpec.js
@@ -11,10 +11,6 @@ describe('scriptDirective', function() {
it('should populate $templateCache with contents of a ng-template script element', inject(
function($compile, $templateCache) {
- if (msie <=8) return;
- // in ie8 it is not possible to create a script tag with the right content.
- // it always comes up as empty. I was trying to set the text of the
- // script tag, but that did not work either, so I gave up.
$compile('<div>foo' +
'<script id="/ignore">ignore me</script>' +
'<script type="text/ng-template" id="/myTemplate.html"><x>{{y}}</x></script>' +
@@ -26,19 +22,18 @@ describe('scriptDirective', function() {
it('should not compile scripts', inject(function($compile, $templateCache, $rootScope) {
- if (msie <=8) return; // see above
-
var doc = jqLite('<div></div>');
- // jQuery is too smart and removes
- doc[0].innerHTML = '<script type="text/javascript">some {{binding}}</script>' +
- '<script type="text/ng-template" id="/some">other {{binding}}</script>';
+ // jQuery is too smart and removes script tags
+ doc[0].innerHTML = 'foo' +
+ '<script type="text/javascript">some {{binding}}</script>' +
+ '<script type="text/ng-template" id="/some">other {{binding}}</script>';
$compile(doc)($rootScope);
$rootScope.$digest();
var scripts = doc.find('script');
- expect(scripts.eq(0).text()).toBe('some {{binding}}');
- expect(scripts.eq(1).text()).toBe('other {{binding}}');
+ expect(scripts.eq(0)[0].text).toBe('some {{binding}}');
+ expect(scripts.eq(1)[0].text).toBe('other {{binding}}');
dealoc(doc);
}));
});