2020-12-18 16:32:22 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const assert = require( 'assert' ),
|
|
|
|
EditPage = require( '../pageobjects/edit.page' ),
|
|
|
|
FeatureFlag = require( '../highlightingfeatureflag' ),
|
|
|
|
FixtureContent = require( '../fixturecontent' ),
|
|
|
|
LoginPage = require( 'wdio-mediawiki/LoginPage' ),
|
|
|
|
UserPreferences = require( '../userpreferences' );
|
|
|
|
|
|
|
|
describe( 'CodeMirror bracket match highlighting for the wikitext 2010 editor', function () {
|
|
|
|
before( function () {
|
|
|
|
LoginPage.loginAdmin();
|
|
|
|
this.title = FixtureContent.createFixturePage();
|
|
|
|
UserPreferences.enableWikitext2010EditorWithCodeMirror();
|
|
|
|
FeatureFlag.enable();
|
|
|
|
} );
|
|
|
|
|
|
|
|
beforeEach( function () {
|
|
|
|
EditPage.openForEditing( this.title );
|
2021-01-08 11:14:55 +00:00
|
|
|
EditPage.wikiEditorToolbar.waitForDisplayed();
|
2020-12-18 16:32:22 +00:00
|
|
|
EditPage.clickText();
|
|
|
|
} );
|
|
|
|
|
2021-01-08 11:14:55 +00:00
|
|
|
it( 'highlights matching bracket', function () {
|
2020-12-18 16:32:22 +00:00
|
|
|
EditPage.cursorToPosition( 0 );
|
|
|
|
assert.strictEqual( EditPage.getHighlightedMatchingBrackets(), '[]' );
|
|
|
|
} );
|
|
|
|
|
2021-01-08 11:14:55 +00:00
|
|
|
it( 'matches according to cursor movement', function () {
|
2020-12-18 16:32:22 +00:00
|
|
|
EditPage.cursorToPosition( 3 );
|
|
|
|
// FIXME: wait for hook to fire
|
|
|
|
browser.pause( 100 );
|
|
|
|
assert.strictEqual( EditPage.getHighlightedMatchingBrackets(), '{}' );
|
|
|
|
} );
|
|
|
|
} );
|