mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-12-21 18:12:42 +00:00
27f964e240
Bug: T270240 Change-Id: If1a2530e428122713277fbe87cd015cb729ab550 Depends-On: I2ba889e1a5dd03549d8d7cb00678a30882ff03fe
38 lines
864 B
JavaScript
38 lines
864 B
JavaScript
'use strict';
|
|
|
|
const BlankPage = require( 'wdio-mediawiki/BlankPage' );
|
|
const Util = require( 'wdio-mediawiki/Util' );
|
|
|
|
class UserPreferences {
|
|
setPreferences( preferences ) {
|
|
BlankPage.open();
|
|
Util.waitForModuleState( 'mediawiki.base' );
|
|
|
|
return browser.execute( function ( prefs ) {
|
|
return mw.loader.using( 'mediawiki.api' ).then( function () {
|
|
return new mw.Api().saveOptions( prefs );
|
|
} );
|
|
}, preferences );
|
|
}
|
|
|
|
enableWikitext2010EditorWithCodeMirror() {
|
|
this.setPreferences( {
|
|
usebetatoolbar: '1',
|
|
usecodemirror: '1',
|
|
'visualeditor-enable': '0',
|
|
'visualeditor-newwikitext': '0'
|
|
} );
|
|
}
|
|
|
|
enableWikitext2017EditorWithCodeMirror() {
|
|
this.setPreferences( {
|
|
usebetatoolbar: null,
|
|
usecodemirror: '1',
|
|
'visualeditor-enable': '1',
|
|
'visualeditor-newwikitext': '1'
|
|
} );
|
|
}
|
|
}
|
|
|
|
module.exports = new UserPreferences();
|