mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +00:00
15215cb81f
This removes the need for a separate init module. Using `__non_webpack_require__` will force Webpack to compile as `require` instead of `__webpack_require__`, allowing ResourceLoader to inject the virtual file. Change-Id: I00203f4665b49cb92ee9db356445fdc2ab17fc5f
20 lines
657 B
JavaScript
20 lines
657 B
JavaScript
global.mw = require( '@wikimedia/mw-node-qunit/src/mockMediaWiki.js' )();
|
|
mw.user = Object.assign( mw.user, {
|
|
options: {
|
|
// Only called for 'usecodemirror' option.
|
|
get: jest.fn().mockReturnValue( 1 ),
|
|
set: jest.fn()
|
|
},
|
|
sessionId: jest.fn().mockReturnValue( 'abc' ),
|
|
getId: jest.fn().mockReturnValue( 123 ),
|
|
isNamed: jest.fn().mockReturnValue( true )
|
|
} );
|
|
mw.config.get = jest.fn().mockReturnValue( '1000+ edits' );
|
|
mw.track = jest.fn();
|
|
mw.Api.prototype.saveOption = jest.fn();
|
|
|
|
// eslint-disable-next-line no-underscore-dangle, camelcase
|
|
global.__non_webpack_require__ = jest.fn();
|
|
global.$ = require( 'jquery' );
|
|
$.fn.textSelection = () => {};
|