update jsdom dependency, fix tests

This commit is contained in:
El RIDO 2025-02-27 08:16:30 +01:00
parent 64b0e33574
commit 4e518b3fce
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
8 changed files with 678 additions and 888 deletions

View file

@ -1,5 +1,5 @@
'use strict';
var common = require('../common');
const common = require('../common');
describe('AttachmentViewer', function () {
describe('setAttachment, showAttachment, removeAttachment, hideAttachment, hideAttachmentPreview, hasAttachment, getAttachment & moveAttachmentTo', function () {
@ -14,11 +14,12 @@ describe('AttachmentViewer', function () {
'string',
function (mimeType, rawdata, filename, prefix, postfix) {
let clean = jsdom(),
data = 'data:' + mimeType + ';base64,' + btoa(rawdata),
data = 'data:' + mimeType + ';base64,' + common.btoa(rawdata),
mimePrefix = mimeType.substring(0, 6),
previewSupported = (
mimeType.substring(0, 6) === 'image/' ||
mimeType.substring(0, 6) === 'audio/' ||
mimeType.substring(0, 6) === 'video/' ||
mimePrefix === 'image/' ||
mimePrefix === 'audio/' ||
mimePrefix === 'video/' ||
mimeType.match(/\/pdf/i)
),
results = [],
@ -48,6 +49,7 @@ describe('AttachmentViewer', function () {
$('#attachment').hasClass('hidden') &&
$('#attachmentPreview').hasClass('hidden')
);
global.atob = common.atob;
if (filename.length) {
$.PrivateBin.AttachmentViewer.setAttachment(data, filename);
} else {