mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-08-06 13:34:27 -04:00

Some of the references to "paste" in code or comments got changed as well, but to clarify the intended usage of the terms: - A PrivateBin document can consist of a paste text (key "paste" in the encrypted payload) and one or several attachments and discussion entries. - Internally the root document is called a "Paste" and each discussion entry is called a "Discussion". - When referring to a whole document with one paste and optional discussion(s), we call it just "document". - When talking about a particular JSON payload type in the internal logic, i.e. during storage or transmission, we call them a paste or discussion to distinguish which type we refer to. closes #397
70 lines
2.9 KiB
JavaScript
70 lines
2.9 KiB
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
describe('Editor', function () {
|
|
describe('show, hide, getText, setText & isPreview', function () {
|
|
this.timeout(30000);
|
|
|
|
jsc.property(
|
|
'returns text fed into the textarea, handles editor tabs',
|
|
'string',
|
|
function (text) {
|
|
var clean = jsdom(),
|
|
results = [];
|
|
$('body').html(
|
|
'<ul id="editorTabs" class="nav nav-tabs hidden"><li ' +
|
|
'role="presentation" class="active"><a id="messageedit" ' +
|
|
'href="#">Editor</a></li><li role="presentation"><a ' +
|
|
'id="messagepreview" href="#">Preview</a></li></ul><div ' +
|
|
'id="placeholder" class="hidden">+++ no document text +++</div>' +
|
|
'<div id="prettymessage" class="hidden"><pre id="prettyprint" ' +
|
|
'class="prettyprint linenums:1"></pre></div><div ' +
|
|
'id="plaintext" class="hidden"></div><p><textarea ' +
|
|
'id="message" name="message" cols="80" rows="25" ' +
|
|
'class="form-control hidden"></textarea></p>'
|
|
);
|
|
$.PrivateBin.Editor.init();
|
|
results.push(
|
|
$('#editorTabs').hasClass('hidden') &&
|
|
$('#message').hasClass('hidden')
|
|
);
|
|
$.PrivateBin.Editor.show();
|
|
results.push(
|
|
!$('#editorTabs').hasClass('hidden') &&
|
|
!$('#message').hasClass('hidden')
|
|
);
|
|
$.PrivateBin.Editor.hide();
|
|
results.push(
|
|
$('#editorTabs').hasClass('hidden') &&
|
|
$('#message').hasClass('hidden')
|
|
);
|
|
$.PrivateBin.Editor.show();
|
|
$.PrivateBin.Editor.focusInput();
|
|
results.push(
|
|
$.PrivateBin.Editor.getText().length === 0
|
|
);
|
|
$.PrivateBin.Editor.setText(text);
|
|
results.push(
|
|
$.PrivateBin.Editor.getText() === $('#message').val()
|
|
);
|
|
$.PrivateBin.Editor.setText();
|
|
results.push(
|
|
!$.PrivateBin.Editor.isPreview() &&
|
|
!$('#message').hasClass('hidden')
|
|
);
|
|
$('#messagepreview').trigger('click');
|
|
results.push(
|
|
$.PrivateBin.Editor.isPreview() &&
|
|
$('#message').hasClass('hidden')
|
|
);
|
|
$('#messageedit').trigger('click');
|
|
results.push(
|
|
!$.PrivateBin.Editor.isPreview() &&
|
|
!$('#message').hasClass('hidden')
|
|
);
|
|
clean();
|
|
return results.every(element => element);
|
|
}
|
|
);
|
|
});
|
|
});
|