mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 15:16:50 +00:00
Merge "Don't bail out early when there are no selectors configured"
This commit is contained in:
commit
8fc7222b26
BIN
resources/dist/index.js
vendored
BIN
resources/dist/index.js
vendored
Binary file not shown.
BIN
resources/dist/index.js.map.json
vendored
BIN
resources/dist/index.js.map.json
vendored
Binary file not shown.
|
@ -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();
|
||||
|
||||
/*
|
||||
|
|
|
@ -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: () => {
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue