mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-07-22 06:28:46 -04:00
Custom clipboard object added to the unit tests
This commit is contained in:
parent
6c651ea676
commit
48eb6ef87a
4 changed files with 34 additions and 50 deletions
19
js/common.js
19
js/common.js
|
@ -152,3 +152,22 @@ exports.urlToString = function (url) {
|
|||
encodeURI(url.query.join('').replace(/^&+|&+$/gm,'')) : '') +
|
||||
(url.fragment ? '#' + encodeURI(url.fragment) : '');
|
||||
};
|
||||
|
||||
exports.enableClipboard = function () {
|
||||
navigator.clipboard = (function () {
|
||||
let savedText = "";
|
||||
|
||||
async function writeText(text) {
|
||||
savedText = text;
|
||||
};
|
||||
|
||||
async function readText() {
|
||||
return savedText;
|
||||
};
|
||||
|
||||
return {
|
||||
writeText,
|
||||
readText,
|
||||
};
|
||||
})();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue