diff --git a/js/privatebin.js b/js/privatebin.js index 197ec58a..b27e0d02 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2568,7 +2568,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { } /** - * Shows all elements belonging to viwing an existing pastes + * Shows all navigation elements for viewing an existing paste * * @name TopNav.showViewButtons * @function @@ -2589,7 +2589,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { }; /** - * Hides all elements belonging to existing pastes + * Hides all navigation elements for viewing an existing paste * * @name TopNav.hideViewButtons * @function diff --git a/js/test/TopNav.js b/js/test/TopNav.js index 6b275c83..9deacf57 100644 --- a/js/test/TopNav.js +++ b/js/test/TopNav.js @@ -8,7 +8,7 @@ describe('TopNav', function () { }); it( - 'display & hide navigation elements for viewing an existing paste', + 'displays & hides navigation elements for viewing an existing paste', function () { var results = []; $('body').html( @@ -37,6 +37,81 @@ describe('TopNav', function () { $('#rawtextbutton').hasClass('hidden') && $('#qrcodelink').hasClass('hidden') ); + $.PrivateBin.TopNav.showViewButtons(); + results.push( + !$('#newbutton').hasClass('hidden') && + !$('#clonebutton').hasClass('hidden') && + !$('#rawtextbutton').hasClass('hidden') && + !$('#qrcodelink').hasClass('hidden') + ); + $.PrivateBin.TopNav.hideViewButtons(); + results.push( + $('#newbutton').hasClass('hidden') && + $('#clonebutton').hasClass('hidden') && + $('#rawtextbutton').hasClass('hidden') && + $('#qrcodelink').hasClass('hidden') + ); + cleanup(); + return results.every(element => element); + } + ); + }); + + describe('showCreateButtons & hideCreateButtons', function () { + before(function () { + cleanup(); + }); + + it( + 'displays & hides navigation elements for creating a paste', + function () { + var results = []; + $('body').html( + '' + ); + $.PrivateBin.TopNav.init(); + results.push( + $('#sendbutton').hasClass('hidden') && + $('#expiration').hasClass('hidden') && + $('#formatter').hasClass('hidden') && + $('#burnafterreadingoption').hasClass('hidden') && + $('#opendiscussionoption').hasClass('hidden') && + $('#newbutton').hasClass('hidden') && + $('#password').hasClass('hidden') && + $('#attach').hasClass('hidden') + ); + $.PrivateBin.TopNav.showCreateButtons(); + results.push( + !$('#sendbutton').hasClass('hidden') && + !$('#expiration').hasClass('hidden') && + !$('#formatter').hasClass('hidden') && + !$('#burnafterreadingoption').hasClass('hidden') && + !$('#opendiscussionoption').hasClass('hidden') && + !$('#newbutton').hasClass('hidden') && + !$('#password').hasClass('hidden') && + !$('#attach').hasClass('hidden') + ); + $.PrivateBin.TopNav.hideCreateButtons(); + results.push( + $('#sendbutton').hasClass('hidden') && + $('#expiration').hasClass('hidden') && + $('#formatter').hasClass('hidden') && + $('#burnafterreadingoption').hasClass('hidden') && + $('#opendiscussionoption').hasClass('hidden') && + $('#newbutton').hasClass('hidden') && + $('#password').hasClass('hidden') && + $('#attach').hasClass('hidden') + ); cleanup(); return results.every(element => element); } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index c1e3a6e0..cb850e67 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -75,7 +75,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 5992336c..2cc35d0f 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -54,7 +54,7 @@ if ($QRCODE): - +