mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-30 18:34:40 +00:00
76e02fae98
Notice how this actually reduces the size of the final, compiled index.js. It's not much, but still. One issue I noticed is that the coverage reports for the JS code stopped working. I have no idea why. Bug: T208951 Change-Id: I2fe92579574b3b1ba4d2dd064899eee944045a96
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import createPagePreviewGateway from '../../../src/gateway/page';
|
|
import * as RestModule from '../../../src/gateway/rest';
|
|
import * as MediawikiModule from '../../../src/gateway/mediawiki';
|
|
|
|
QUnit.module( 'gateway/page.js', {
|
|
beforeEach() {
|
|
mw.Api = function () {};
|
|
|
|
this.createMediaWikiApiGateway =
|
|
this.sandbox.stub( MediawikiModule, 'default' );
|
|
this.createRESTBaseGateway = this.sandbox.stub( RestModule, 'default' );
|
|
|
|
this.config = new Map();
|
|
}
|
|
} );
|
|
|
|
QUnit.test( 'it uses mediawiki plain text gateway with wgPopupsGateway == "mwApiPlain"', function ( assert ) {
|
|
this.config.set( 'wgPopupsGateway', 'mwApiPlain' );
|
|
|
|
createPagePreviewGateway( this.config );
|
|
|
|
assert.ok( this.createMediaWikiApiGateway.called,
|
|
'MW plain text gateway called' );
|
|
} );
|
|
|
|
QUnit.test( 'it uses rest plain text gateway with wgPopupsGateway == "restbasePlain"', function ( assert ) {
|
|
this.config.set( 'wgPopupsGateway', 'restbasePlain' );
|
|
|
|
createPagePreviewGateway( this.config );
|
|
|
|
assert.ok( this.createRESTBaseGateway.called,
|
|
'REST plain text gateway called' );
|
|
} );
|
|
|
|
QUnit.test( 'it uses rest HTML gateway with wgPopupsGateway == "restbaseHTML"', function ( assert ) {
|
|
this.config.set( 'wgPopupsGateway', 'restbaseHTML' );
|
|
|
|
createPagePreviewGateway( this.config );
|
|
|
|
assert.ok( this.createRESTBaseGateway.called, 'REST HTML gateway called' );
|
|
} );
|