Re-enable disabled ReferencePreviews Qunit test

I could just remove the getElementById replacement that was
failing the tests. In the Popups extension there really is a
renderer test that mocks this function call but that test is not
part of this file.

Also it seems that tracking is never triggered here. I think that
the beacon overwrite was only added to avoid tracking.

See I2638611ba67b785338f7e98a1c4b08a5e829812d

Change-Id: Ic3540f6f73783e79c81e2b693d2bf96cfc7fc66b
This commit is contained in:
WMDE-Fisch 2024-07-01 17:18:56 +02:00
parent 2957948239
commit ccf3809413

View file

@ -1,8 +1,9 @@
let createReferencePreview;
const previewTypes = { TYPE_REFERENCE: 'reference' };
// TODO: Fix this test. Currently failing on `document.getElementById`
QUnit.module.skip( 'ext.cite.referencePreviews#renderer', {
( mw.loader.getModuleNames().indexOf( 'ext.popups.main' ) !== -1 ?
QUnit.module :
QUnit.module.skip )( 'ext.cite.referencePreviews#renderer', {
before() {
createReferencePreview = require( 'ext.cite.referencePreviews' ).private.createReferencePreview;
},
@ -13,19 +14,8 @@ QUnit.module.skip( 'ext.cite.referencePreviews#renderer', {
mw.html = {
escape: ( str ) => str && str.replace( /'/g, '&apos;' ).replace( /</g, '&lt;' )
};
mw.track = () => {};
global.navigator = {
sendBeacon() {}
};
// Some tests below stub this function. Keep a copy so it can be restored.
this.getElementById = document.getElementById;
},
afterEach() {
// Restore getElementsById to its original state.
document.getElementById = this.getElementById;
mw.msg = null;
mw.message = null;
mw.html = null;