diff --git a/js/test/TopNav.js b/js/test/TopNav.js index e5a29c4..314d5ce 100644 --- a/js/test/TopNav.js +++ b/js/test/TopNav.js @@ -317,6 +317,92 @@ describe('TopNav', function () { ); }); + describe('resetInput', function () { + before(function () { + cleanup(); + }); + + it( + 'reset inputs to defaults (options off)', + function () { + var results = []; + $('body').html( + '' + ); + $.PrivateBin.TopNav.init(); + results.push( + !$.PrivateBin.TopNav.getBurnAfterReading() + ); + results.push( + !$.PrivateBin.TopNav.getOpenDiscussion() + ); + $('#burnafterreading').attr('checked', 'checked'); + $('#opendiscussion').attr('checked', 'checked'); + results.push( + $.PrivateBin.TopNav.getBurnAfterReading() + ); + results.push( + $.PrivateBin.TopNav.getOpenDiscussion() + ); + $.PrivateBin.TopNav.resetInput(); + results.push( + !$.PrivateBin.TopNav.getBurnAfterReading() + ); + results.push( + !$.PrivateBin.TopNav.getOpenDiscussion() + ); + cleanup(); + assert.ok(results.every(element => element)); + } + ); + + it( + 'reset inputs to defaults (options on)', + function () { + var results = []; + $('body').html( + '' + ); + $.PrivateBin.TopNav.init(); + results.push( + $.PrivateBin.TopNav.getBurnAfterReading() + ); + results.push( + $.PrivateBin.TopNav.getOpenDiscussion() + ); + $('#burnafterreading').removeAttr('checked'); + $('#opendiscussion').removeAttr('checked'); + results.push( + !$.PrivateBin.TopNav.getBurnAfterReading() + ); + results.push( + !$.PrivateBin.TopNav.getOpenDiscussion() + ); + $.PrivateBin.TopNav.resetInput(); + results.push( + $.PrivateBin.TopNav.getBurnAfterReading() + ); + results.push( + $.PrivateBin.TopNav.getOpenDiscussion() + ); + cleanup(); + assert.ok(results.every(element => element)); + } + ); + }); + describe('getExpiration', function () { before(function () { cleanup();