diff --git a/js/test/TopNav.js b/js/test/TopNav.js
index a6ec9094..c1a40906 100644
--- a/js/test/TopNav.js
+++ b/js/test/TopNav.js
@@ -11,7 +11,7 @@ describe('TopNav', function () {
'displays & hides navigation elements for viewing an existing document',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
``
- );
+ `;
PrivateBin.TopNav.init();
results.push(
$('#newbutton').hasClass('hidden') &&
@@ -65,7 +64,7 @@ describe('TopNav', function () {
'displays & hides navigation elements for creating a document',
function () { // eslint-disable-line complexity
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'class="hidden">Create';
PrivateBin.TopNav.init();
results.push(
$('#sendbutton').hasClass('hidden') &&
@@ -130,10 +128,9 @@ describe('TopNav', function () {
'displays the button for creating a document',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '"button" class="hidden">New';
PrivateBin.TopNav.init();
results.push(
$('#newbutton').hasClass('hidden')
@@ -161,12 +158,11 @@ describe('TopNav', function () {
'hides the button for cloning a document',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '"true"> Clone';
PrivateBin.TopNav.init();
results.push(
!$('#clonebutton').hasClass('hidden')
@@ -194,13 +190,12 @@ describe('TopNav', function () {
'hides the raw text button',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'Raw text';
PrivateBin.TopNav.init();
results.push(
!$('#rawtextbutton').hasClass('hidden')
@@ -228,7 +223,7 @@ describe('TopNav', function () {
'hides the file attachment selection button',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '';
PrivateBin.TopNav.init();
results.push(
!$('#filewrap').hasClass('hidden')
@@ -266,7 +260,7 @@ describe('TopNav', function () {
'display the custom file attachment',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '';
PrivateBin.TopNav.init();
results.push(
$('#customattachment').hasClass('hidden')
@@ -304,7 +297,7 @@ describe('TopNav', function () {
'collapses the navigation when displayed on a small screen',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '"button" class="hidden">New';
PrivateBin.TopNav.init();
results.push(
$('.navbar-toggle').hasClass('collapsed') &&
@@ -357,15 +349,14 @@ describe('TopNav', function () {
'reset inputs to defaults (options off)',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'Open discussion';
PrivateBin.TopNav.init();
results.push(
!PrivateBin.TopNav.getBurnAfterReading()
@@ -401,15 +392,14 @@ describe('TopNav', function () {
'reset inputs to defaults (burnafterreading on)',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'Open discussion';
PrivateBin.TopNav.init();
results.push(
PrivateBin.TopNav.getBurnAfterReading()
@@ -444,15 +434,14 @@ describe('TopNav', function () {
'reset inputs to defaults (opendiscussion on)',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'Open discussion';
PrivateBin.TopNav.init();
results.push(
!PrivateBin.TopNav.getBurnAfterReading()
@@ -493,11 +482,10 @@ describe('TopNav', function () {
it(
'returns the currently selected expiration date',
function () {
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '';
PrivateBin.TopNav.init();
assert.strictEqual(PrivateBin.TopNav.getExpiration(), '1day');
cleanup();
@@ -551,7 +539,7 @@ describe('TopNav', function () {
'returns the selected files',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '';
PrivateBin.TopNav.init();
results.push(
PrivateBin.TopNav.getFileList() === null
@@ -594,12 +581,11 @@ describe('TopNav', function () {
'returns if the burn-after-reading checkbox was ticked',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'Burn after reading';
PrivateBin.TopNav.init();
results.push(
!PrivateBin.TopNav.getBurnAfterReading()
@@ -631,12 +617,11 @@ describe('TopNav', function () {
'returns if the open-discussion checkbox was ticked',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'Open discussion';
PrivateBin.TopNav.init();
results.push(
!PrivateBin.TopNav.getOpenDiscussion()
@@ -670,12 +655,11 @@ describe('TopNav', function () {
function (password) {
password = password.replace(/\r+|\n+/g, '');
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ 'class="form-control" size="23" />';
PrivateBin.TopNav.init();
results.push(
PrivateBin.TopNav.getPassword() === ''
@@ -707,7 +691,7 @@ describe('TopNav', function () {
'returns the custom attachment element',
function () {
let results = [];
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ '';
PrivateBin.TopNav.init();
results.push(
!PrivateBin.TopNav.getCustomAttachment().hasClass('test')
@@ -746,7 +729,7 @@ describe('TopNav', function () {
function () {
// Insert any setup code needed for the hideAllButtons function
// Example: Initialize the DOM elements required for testing
- $('body').html(
+ document.documentElement.innerHTML =
''
- );
+ ' QR code';
PrivateBin.TopNav.init();
PrivateBin.TopNav.hideAllButtons();
@@ -787,7 +769,7 @@ describe('TopNav', function () {
'displays raw text view correctly',
function () {
const clean = globalThis.cleanup('', {url: 'https://privatebin.net/?0123456789abcdef#1'});
- $('body').html('');
+ document.documentElement.innerHTML ='';
const sample = 'example';
PrivateBin.PasteViewer.setText(sample);
PrivateBin.Helper.reset();