mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 23:50:05 +00:00
9e9a38d6fc
Bug: T300205 Change-Id: Idfcfc984833ca6ca6c09500cd4715a4e5504f84e
38 lines
901 B
JavaScript
38 lines
901 B
JavaScript
'use strict';
|
|
|
|
const BlankPage = require( 'wdio-mediawiki/BlankPage' ),
|
|
Util = require( 'wdio-mediawiki/Util' );
|
|
|
|
class UserPreferences {
|
|
async setPreferences( preferences ) {
|
|
await BlankPage.open();
|
|
Util.waitForModuleState( 'mediawiki.base' );
|
|
|
|
return await browser.execute( function ( prefs ) {
|
|
return mw.loader.using( 'mediawiki.api' ).then( function () {
|
|
return new mw.Api().saveOptions( prefs );
|
|
} );
|
|
}, preferences );
|
|
}
|
|
|
|
async enableWikitext2010EditorWithCodeMirror() {
|
|
await this.setPreferences( {
|
|
usebetatoolbar: '1',
|
|
usecodemirror: '1',
|
|
'visualeditor-enable': '0',
|
|
'visualeditor-newwikitext': '0'
|
|
} );
|
|
}
|
|
|
|
async enableWikitext2017EditorWithCodeMirror() {
|
|
await this.setPreferences( {
|
|
usebetatoolbar: null,
|
|
usecodemirror: '1',
|
|
'visualeditor-enable': '1',
|
|
'visualeditor-newwikitext': '1'
|
|
} );
|
|
}
|
|
}
|
|
|
|
module.exports = new UserPreferences();
|