From f699ca6cd42a788f84be87321d2065e4f6a23fc1 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 5 Feb 2017 18:46:24 +0100 Subject: [PATCH] writing tests for htmlEntities function --- js/test.js | 15 +++++++++++++++ tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/js/test.js b/js/test.js index a283275..5e4d3c3 100644 --- a/js/test.js +++ b/js/test.js @@ -140,5 +140,20 @@ describe('helper', function () { } ); }); + + describe('htmlEntities', function () { + after(function () { + cleanup(); + }); + + jsc.property( + 'removes all HTML entities from any given string', + 'string', + function (string) { + var result = $.PrivateBin.helper.htmlEntities(string); + return !(/[<>"'`=\/]/.test(result)) && !(string.indexOf('&') > -1 && !(/&/.test(result))); + } + ); + }); }); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 041b569..668b2e9 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 3aab3d6..362e887 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - +