diff --git a/js/privatebin.js b/js/privatebin.js index bb742ea..34a00f1 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -224,7 +224,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { * @see {@link http://www.w3schools.com/js/js_cookies.asp} * @name helper.getCookie * @function - * @param {string} cname + * @param {string} cname - may not be empty * @return {string} */ getCookie: function(cname) { diff --git a/js/test.js b/js/test.js index b5845ae..6879206 100644 --- a/js/test.js +++ b/js/test.js @@ -313,6 +313,33 @@ describe('helper', function () { ); }); + describe('getCookie', function () { + jsc.property( + 'returns the requested cookie', + 'nearray asciinestring', + 'nearray asciistring', + function (labels, values) { + var selectedKey = '', selectedValue = '', + cookieArray = [], + count = 0; + labels.forEach(function(item, i) { + var key = item.replace(/[\s;,=]/g, 'x'), + value = (values[i] || values[0]).replace(/[\s;,=]/g, ''); + cookieArray.push(key + '=' + value); + if (Math.random() < 1 / i) + { + selectedKey = key; + selectedValue = value; + } + }); + var clean = jsdom('', {cookie: cookieArray}), + result = $.PrivateBin.helper.getCookie(selectedKey); + clean(); + return result === selectedValue; + } + ); + }); + describe('scriptLocation', function () { jsc.property( 'returns the URL without query & fragment', diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 7f8c25a..5f5fe6a 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 f2f8ef7..3bd4b53 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - +