mediawiki-extensions-CodeMi.../tests/selenium/pageobjects/edit.page.js
WMDE-Fisch 9bea2a7905 Refine bracket matching styling
Adds a custom class for matched brackets to allow better integration
with custom bracket styles. The brackets won't be bold in the 2017WTE.
Bold font might lead to misalignment there. See ticket.

Note: box-shadow seems to be supported for quite some time by all
relevant browsers

Bug: T270926
Change-Id: Ica1e301f63a106a96db3bfaba4b2f322af64b009
2021-03-08 09:26:07 +01:00

49 lines
1.4 KiB
JavaScript

'use strict';
const Page = require( 'wdio-mediawiki/Page' );
// Copied from mediawiki-core edit.page.js
class EditPage extends Page {
openForEditing( title ) {
super.openTitle( title, { action: 'edit', vehidebetadialog: 1, hidewelcomedialog: 1 } );
}
get wikiEditorToolbar() { return $( '#wikiEditor-ui-toolbar' ); }
get legacyTextInput() { return $( '#wpTextbox1' ); }
clickText() {
if ( this.visualEditorSave.isDisplayed() ) {
this.visualEditorSurface.click();
} else if ( this.legacyTextInput.isDisplayed() ) {
this.legacyTextInput.click();
} else {
// Click the container, if using WikiEditor etc.
this.legacyTextInput.parentElement().click();
}
}
get visualEditorSave() { return $( '.ve-ui-toolbar-saveButton' ); }
get visualEditorToggle() { return $( '.ve-init-mw-editSwitch' ); }
get visualEditorSurface() { return $( '.ve-ui-surface-source' ); }
cursorToPosition( index ) {
this.clickText();
// Second "Control" deactivates the modifier.
const keys = [ 'Control', 'Home', 'Control' ];
for ( let i = 0; i < index; i++ ) {
keys.push( 'ArrowRight' );
}
browser.keys( keys );
}
getHighlightedMatchingBrackets() {
const elements = $$( '.CodeMirror-line .cm-mw-matchingbracket' );
const matchingTexts = elements.map( function ( el ) {
return el.getText();
} );
return matchingTexts.join( '' );
}
}
module.exports = new EditPage();