Skip to content

Commit 72cd567

Browse files
committed
added specs for testing json scripts
1 parent e62e72a commit 72cd567

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Specs/Browser/Browser.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ describe('Browser.exec', function(){
3636

3737
describe('String.stripScripts', function(){
3838

39-
it('should strip all script tags from a string', function(){
40-
expect('<div><script type="text/javascript" src="file.js"></script></div>'.stripScripts()).to.equal('<div></div>');
41-
});
39+
4240

4341
it('should execute the stripped tags from the string', function(){
4442
expect('<div><script type="text/javascript"> var stripScriptsSpec = 42; </script></div>'.stripScripts(true)).to.equal('<div></div>');
@@ -49,6 +47,11 @@ describe('String.stripScripts', function(){
4947
expect(window.stripScriptsSpec).to.equal(4242);
5048
});
5149

50+
it('should not execute json scripts', function(){
51+
expect('<div><script type="application/json">var stripScriptsSpec424242 = 424242;</script></div>'.stripScripts()).to.equal('<div></div>');
52+
expect(window.stripScriptsSpec424242).to.equal(undefined);
53+
});
54+
5255
});
5356

5457
describe('Document', function(){

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"grunt-karma": "^2.0.0",
3838
"grunt-mocha-test": "^0.12.7",
3939
"grunt-mootools-packager": "^0.4.0",
40-
"karma": "^1.7.0",
40+
"karma": "^1.7.1",
4141
"karma-expect": "^1.1",
4242
"karma-mocha": "^0.2.0",
4343
"karma-phantomjs-launcher": "^1.0.4",

0 commit comments

Comments
 (0)