|
@@ -1,5 +1,5 @@
|
|
|
'use strict';
|
|
'use strict';
|
|
|
-var common = require('../common');
|
|
|
|
|
|
|
+require('../common');
|
|
|
|
|
|
|
|
describe('TopNav', function () {
|
|
describe('TopNav', function () {
|
|
|
describe('showViewButtons & hideViewButtons', function () {
|
|
describe('showViewButtons & hideViewButtons', function () {
|
|
@@ -10,7 +10,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'displays & hides navigation elements for viewing an existing document',
|
|
'displays & hides navigation elements for viewing an existing document',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav class="navbar navbar-inverse navbar-static-top">' +
|
|
'<nav class="navbar navbar-inverse navbar-static-top">' +
|
|
|
'<div id="navbar" class="navbar-collapse collapse"><ul ' +
|
|
'<div id="navbar" class="navbar-collapse collapse"><ul ' +
|
|
@@ -69,7 +69,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'displays & hides navigation elements for creating a document',
|
|
'displays & hides navigation elements for creating a document',
|
|
|
function () { // eslint-disable-line complexity
|
|
function () { // eslint-disable-line complexity
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li><button id="newbutton" ' +
|
|
'<nav><div id="navbar"><ul><li><button id="newbutton" ' +
|
|
|
'type="button" class="hidden">New</button></li><li><a ' +
|
|
'type="button" class="hidden">New</button></li><li><a ' +
|
|
@@ -134,7 +134,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'displays the button for creating a document',
|
|
'displays the button for creating a document',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li><button id="newbutton" type=' +
|
|
'<nav><div id="navbar"><ul><li><button id="newbutton" type=' +
|
|
|
'"button" class="hidden">New</button></li></ul></div></nav>'
|
|
'"button" class="hidden">New</button></li></ul></div></nav>'
|
|
@@ -165,7 +165,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'hides the button for cloning a document',
|
|
'hides the button for cloning a document',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li><button id="clonebutton" ' +
|
|
'<nav><div id="navbar"><ul><li><button id="clonebutton" ' +
|
|
|
'type="button" class="btn btn-warning navbar-btn">' +
|
|
'type="button" class="btn btn-warning navbar-btn">' +
|
|
@@ -198,7 +198,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'hides the raw text button',
|
|
'hides the raw text button',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li><button ' +
|
|
'<nav><div id="navbar"><ul><li><button ' +
|
|
|
'id="rawtextbutton" type="button" class="btn ' +
|
|
'id="rawtextbutton" type="button" class="btn ' +
|
|
@@ -232,7 +232,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'hides the file attachment selection button',
|
|
'hides the file attachment selection button',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
@@ -270,7 +270,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'display the custom file attachment',
|
|
'display the custom file attachment',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
@@ -308,8 +308,8 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'collapses the navigation when displayed on a small screen',
|
|
'collapses the navigation when displayed on a small screen',
|
|
|
function () {
|
|
function () {
|
|
|
- var clean = jsdom(),
|
|
|
|
|
- results = [];
|
|
|
|
|
|
|
+ const clean = jsdom();
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div class="navbar-header"><button type="button" ' +
|
|
'<nav><div class="navbar-header"><button type="button" ' +
|
|
|
'class="navbar-toggle collapsed" data-toggle="collapse" ' +
|
|
'class="navbar-toggle collapsed" data-toggle="collapse" ' +
|
|
@@ -363,7 +363,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'reset inputs to defaults (options off)',
|
|
'reset inputs to defaults (options off)',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
@@ -407,7 +407,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'reset inputs to defaults (burnafterreading on)',
|
|
'reset inputs to defaults (burnafterreading on)',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
@@ -450,7 +450,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'reset inputs to defaults (opendiscussion on)',
|
|
'reset inputs to defaults (opendiscussion on)',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
@@ -517,16 +517,14 @@ describe('TopNav', function () {
|
|
|
cleanup();
|
|
cleanup();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- var File = window.File,
|
|
|
|
|
|
|
+ const File = window.File,
|
|
|
FileList = window.FileList,
|
|
FileList = window.FileList,
|
|
|
path = require('path'), // eslint-disable-line global-require
|
|
path = require('path'), // eslint-disable-line global-require
|
|
|
mime = require('mime-types'); // eslint-disable-line global-require
|
|
mime = require('mime-types'); // eslint-disable-line global-require
|
|
|
|
|
|
|
|
// mocking file input as per https://github.com/jsdom/jsdom/issues/1272
|
|
// mocking file input as per https://github.com/jsdom/jsdom/issues/1272
|
|
|
function createFile(file_path) {
|
|
function createFile(file_path) {
|
|
|
- var file = fs.statSync(file_path),
|
|
|
|
|
- lastModified = file.mtimeMs,
|
|
|
|
|
- size = file.size;
|
|
|
|
|
|
|
+ const lastModified = fs.statSync(file_path).mtimeMs;
|
|
|
|
|
|
|
|
return new File(
|
|
return new File(
|
|
|
[new fs.readFileSync(file_path)],
|
|
[new fs.readFileSync(file_path)],
|
|
@@ -559,7 +557,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'returns the selected files',
|
|
'returns the selected files',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
@@ -579,7 +577,7 @@ describe('TopNav', function () {
|
|
|
'../img/logo.svg',
|
|
'../img/logo.svg',
|
|
|
'../img/busy.gif'
|
|
'../img/busy.gif'
|
|
|
]);
|
|
]);
|
|
|
- var files = $.PrivateBin.TopNav.getFileList();
|
|
|
|
|
|
|
+ const files = $.PrivateBin.TopNav.getFileList();
|
|
|
results.push(
|
|
results.push(
|
|
|
files[0].name === 'logo.svg' &&
|
|
files[0].name === 'logo.svg' &&
|
|
|
files[1].name === 'busy.gif'
|
|
files[1].name === 'busy.gif'
|
|
@@ -602,7 +600,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'returns if the burn-after-reading checkbox was ticked',
|
|
'returns if the burn-after-reading checkbox was ticked',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
'<nav><div id="navbar"><ul><li id="burnafterreadingoption" ' +
|
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
@@ -639,7 +637,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'returns if the open-discussion checkbox was ticked',
|
|
'returns if the open-discussion checkbox was ticked',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="opendiscussionoption" ' +
|
|
'<nav><div id="navbar"><ul><li id="opendiscussionoption" ' +
|
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
'class="hidden"><label><input type="checkbox" ' +
|
|
@@ -678,7 +676,7 @@ describe('TopNav', function () {
|
|
|
'string',
|
|
'string',
|
|
|
function (password) {
|
|
function (password) {
|
|
|
password = password.replace(/\r+|\n+/g, '');
|
|
password = password.replace(/\r+|\n+/g, '');
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li><div id="password" ' +
|
|
'<nav><div id="navbar"><ul><li><div id="password" ' +
|
|
|
'class="navbar-form hidden"><input type="password" ' +
|
|
'class="navbar-form hidden"><input type="password" ' +
|
|
@@ -715,7 +713,7 @@ describe('TopNav', function () {
|
|
|
it(
|
|
it(
|
|
|
'returns the custom attachment element',
|
|
'returns the custom attachment element',
|
|
|
function () {
|
|
function () {
|
|
|
- var results = [];
|
|
|
|
|
|
|
+ let results = [];
|
|
|
$('body').html(
|
|
$('body').html(
|
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
'<nav><div id="navbar"><ul><li id="attach" class="hidden ' +
|
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|
|
'dropdown"><a href="#" class="dropdown-toggle" data-' +
|