Merge "Don't bail out early when there are no selectors configured"

This commit is contained in:
jenkins-bot 2024-01-29 22:28:22 +00:00 committed by Gerrit Code Review
commit 8fc7222b26
5 changed files with 2 additions and 33 deletions

Binary file not shown.

Binary file not shown.

View file

@ -22,8 +22,7 @@ import * as actions from './actions';
import reducers from './reducers';
import createMediaWikiPopupsObject from './integrations/mwpopups';
import { previewTypes, getPreviewType,
registerModel,
isAnythingEligible, findNearestEligibleTarget } from './preview/model';
registerModel, findNearestEligibleTarget } from './preview/model';
import setUserConfigFlags from './setUserConfigFlags';
import { registerGatewayForPreviewType, getGatewayForPreviewType } from './gateway';
import { FETCH_START_DELAY, FETCH_COMPLETE_TARGET_DELAY } from './constants';
@ -253,11 +252,6 @@ function handleDOMEventIfEligible( handler ) {
} );
}
if ( !isAnythingEligible() ) {
mw.log.warn( 'ext.popups was loaded but everything is disabled' );
return;
}
rendererInit();
/*

View file

@ -249,15 +249,6 @@ export function registerModel( type, selector, delay ) {
}
}
/**
* Check whether any kind of preview is enabled.
*
* @return {boolean}
*/
export function isAnythingEligible() {
return !!selectors.length;
}
export const test = {
/** For testing only */
reset: () => {

View file

@ -1,6 +1,6 @@
import {
createModel, getPreviewType, previewTypes, registerModel, test,
isAnythingEligible, findNearestEligibleTarget, createNullModel
findNearestEligibleTarget, createNullModel
} from '../../../src/preview/model';
QUnit.module( 'ext.popups.preview#createModel' );
@ -109,22 +109,6 @@ QUnit.module( 'ext.popups.preview#getPreviewType', {
}
} );
QUnit.test( 'isAnythingEligible returns false by default', function ( assert ) {
test.reset();
assert.strictEqual(
isAnythingEligible(),
false
);
} );
QUnit.test( 'isAnythingEligible returns true when model is registered', function ( assert ) {
this.registerRefModel();
assert.strictEqual(
isAnythingEligible(),
true
);
} );
QUnit.test( 'it uses the reference gateway with valid element', function ( assert ) {
this.registerRefModel();
assert.strictEqual(