Custom clipboard object added to the unit tests

This commit is contained in:
ribas160 2025-01-10 16:23:04 +02:00
parent 6c651ea676
commit 48eb6ef87a
4 changed files with 34 additions and 50 deletions

View file

@ -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,
};
})();
};