diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2014-05-28 22:14:05 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2014-05-28 22:14:05 +0200 |
commit | 360a79b8f492ec8597c1ec8a55c1dde2837c8104 (patch) | |
tree | add536e6349d0bc544d62907f202f68b6a9a75fc /core/js | |
parent | 6e424eb990e7640f6d8f2cb25fe97024ebd95a05 (diff) | |
download | nextcloud-server-360a79b8f492ec8597c1ec8a55c1dde2837c8104.tar.gz nextcloud-server-360a79b8f492ec8597c1ec8a55c1dde2837c8104.zip |
Add unit tests for escapeHTML
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/tests/specs/coreSpec.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index ccd9f7a1288..fb237bad5df 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -124,6 +124,17 @@ describe('Core base tests', function() { expect(OC.dirname('/subdir/')).toEqual('/subdir'); }); }); + describe('escapeHTML', function() { + it('Returns nothing if no string was given', function() { + expect(escapeHTML('')).toEqual(''); + }); + it('Returns a sanitized string if a string containing HTML is given', function() { + expect(escapeHTML('There needs to be a <script>alert(\"Unit\" + \'test\')</script> for it!')).toEqual('There needs to be a <script>alert("Unit" + 'test')</script> for it!'); + }); + it('Returns the string without modification if no potential dangerous character is passed.', function() { + expect(escapeHTML('This is a good string without HTML.')).toEqual('This is a good string without HTML.'); + }); + }); describe('Link functions', function() { var TESTAPP = 'testapp'; var TESTAPP_ROOT = OC.webroot + '/appsx/testapp'; |