Skip to content

Commit

Permalink
added specs for testing json scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mavstuff committed Feb 14, 2020
1 parent e62e72a commit 72cd567
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Specs/Browser/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ describe('Browser.exec', function(){

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

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


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

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

});

describe('Document', function(){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"grunt-karma": "^2.0.0",
"grunt-mocha-test": "^0.12.7",
"grunt-mootools-packager": "^0.4.0",
"karma": "^1.7.0",
"karma": "^1.7.1",
"karma-expect": "^1.1",
"karma-mocha": "^0.2.0",
"karma-phantomjs-launcher": "^1.0.4",
Expand Down

0 comments on commit 72cd567

Please sign in to comment.