|
|
@@ -18,15 +18,15 @@ describe('CopyToClipboard', function () {
|
|
|
document.body.innerHTML = (
|
|
|
'<div id="status" class="hidden"></div>' +
|
|
|
'<div id="errormessage" class="hidden"></div>' +
|
|
|
- '<div id="placeholder"></div>' +
|
|
|
- '<div id="attachmentPreview" class="hidden"></div>' +
|
|
|
- '<h5 id="copyShortcutHint" class="hidden">' +
|
|
|
- '<small id="copyShortcutHintText"></small>' +
|
|
|
+ '<div id="placeholder" class="hidden">+++ no document text ' +
|
|
|
+ '+++</div><div id="prettymessage" class="hidden">' +
|
|
|
+ '<button type="button" id="prettyMessageCopyBtn"><svg id="copyIcon"></svg>' +
|
|
|
+ '<svg id="copySuccessIcon"></svg></button><pre ' +
|
|
|
+ 'id="prettyprint" class="prettyprint linenums:1"></pre>' +
|
|
|
+ '</div><div id="plaintext" class="hidden"></div>' +
|
|
|
+ '<h5 id="copyShortcutHint" class="hidden">' +
|
|
|
'<button type="button" id="copyShortcutHintBtn"></button>' +
|
|
|
- '</h5>' +
|
|
|
- '<div id="prettymessage" class="hidden">' +
|
|
|
- '<pre id="prettyprint"></pre>' +
|
|
|
- '</div>'
|
|
|
+ '</h5>'
|
|
|
);
|
|
|
|
|
|
PrivateBin.Alert.init();
|
|
|
@@ -60,15 +60,15 @@ describe('CopyToClipboard', function () {
|
|
|
document.body.innerHTML = (
|
|
|
'<div id="status" class="hidden"></div>' +
|
|
|
'<div id="errormessage" class="hidden"></div>' +
|
|
|
- '<div id="placeholder"></div> ' +
|
|
|
- '<div id="attachmentPreview" class="hidden"></div>' +
|
|
|
- '<h5 id="copyShortcutHint" class="hidden">' +
|
|
|
- '<small id="copyShortcutHintText"></small>' +
|
|
|
- '<button type="button" id="copyShortcutHintBtn"></button>' +
|
|
|
- '</h5>' +
|
|
|
- '<div id="prettymessage" class="hidden">' +
|
|
|
- '<pre id="prettyprint"></pre>' +
|
|
|
- '</div>'
|
|
|
+ '<div id="placeholder">+++ no document text ' +
|
|
|
+ '+++</div><div id="prettymessage" class="hidden">' +
|
|
|
+ '<button type="button" id="prettyMessageCopyBtn"><svg id="copyIcon"></svg>' +
|
|
|
+ '<svg id="copySuccessIcon"></svg></button><pre ' +
|
|
|
+ 'id="prettyprint" class="prettyprint linenums:1"></pre>' +
|
|
|
+ '</div><div id="plaintext" class="hidden"></div>' +
|
|
|
+ '<h5 id="copyShortcutHint" class="hidden">' +
|
|
|
+ '<button type="button" id="copyShortcutHintBtn"></button>' +
|
|
|
+ '</h5>'
|
|
|
);
|
|
|
|
|
|
PrivateBin.Alert.init();
|
|
|
@@ -137,37 +137,30 @@ describe('CopyToClipboard', function () {
|
|
|
});
|
|
|
|
|
|
describe('Keyboard shortcut hint', function () {
|
|
|
- jsc.property('Show hint', function () {
|
|
|
- var clean = jsdom();
|
|
|
-
|
|
|
- $('body').html('<small id="copyShortcutHintText"></small>');
|
|
|
+ it('shows hint', () => {
|
|
|
+ fc.assert(fc.property(fc.string(),
|
|
|
+ function (text) {
|
|
|
+ document.body.innerHTML = '<h5 id="copyShortcutHint" class="hidden"></h5>';
|
|
|
|
|
|
PrivateBin.CopyToClipboard.init();
|
|
|
PrivateBin.CopyToClipboard.showKeyboardShortcutHint();
|
|
|
|
|
|
- const keyboardShortcutHint = $('#copyShortcutHintText').text();
|
|
|
-
|
|
|
- clean();
|
|
|
-
|
|
|
- return !hasHidden;
|
|
|
+ return !document.getElementById('copyShortcutHint').classList.contains('hidden');
|
|
|
}
|
|
|
));
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- jsc.property('Hide hint', function () {
|
|
|
- var clean = jsdom();
|
|
|
-
|
|
|
- $('body').html('<small id="copyShortcutHintText">' + text + '</small>');
|
|
|
+ it('Hide hint', () => {
|
|
|
+ fc.assert(fc.property(
|
|
|
+ fc.string({minLength: 1}),
|
|
|
+ function (text) {
|
|
|
+ document.body.innerHTML = '<h5 id="copyShortcutHint"></h5>';
|
|
|
|
|
|
PrivateBin.CopyToClipboard.init();
|
|
|
PrivateBin.CopyToClipboard.hideKeyboardShortcutHint();
|
|
|
|
|
|
- const keyboardShortcutHint = $('#copyShortcutHintText').text();
|
|
|
-
|
|
|
- clean();
|
|
|
-
|
|
|
- return hasHidden;
|
|
|
+ return document.getElementById('copyShortcutHint').classList.contains('hidden');
|
|
|
}
|
|
|
));
|
|
|
});
|