2020-12-18 16:32:22 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const assert = require( 'assert' ),
|
|
|
|
EditPage = require( '../pageobjects/edit.page' ),
|
|
|
|
FixtureContent = require( '../fixturecontent' ),
|
2023-04-03 17:14:23 +00:00
|
|
|
UserPreferences = require( '../userpreferences' ),
|
|
|
|
Util = require( 'wdio-mediawiki/Util' );
|
2020-12-18 16:32:22 +00:00
|
|
|
|
2024-06-14 11:51:53 +00:00
|
|
|
describe( 'CodeMirror bracket match highlighting for the wikitext 2010 editor', () => {
|
2023-04-03 17:14:23 +00:00
|
|
|
let title;
|
|
|
|
|
2024-06-14 11:51:53 +00:00
|
|
|
before( async () => {
|
2023-04-03 17:14:23 +00:00
|
|
|
title = Util.getTestString( 'CodeMirror-fixture1-' );
|
2023-06-29 12:27:57 +00:00
|
|
|
await UserPreferences.loginAsOther();
|
2023-04-03 17:14:23 +00:00
|
|
|
await FixtureContent.createFixturePage( title );
|
|
|
|
await UserPreferences.enableWikitext2010EditorWithCodeMirror();
|
2020-12-18 16:32:22 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-14 11:51:53 +00:00
|
|
|
beforeEach( async () => {
|
2023-04-03 17:14:23 +00:00
|
|
|
await EditPage.openForEditing( title );
|
|
|
|
await EditPage.wikiEditorToolbar.waitForDisplayed();
|
|
|
|
await EditPage.clickText();
|
2020-12-18 16:32:22 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-14 11:51:53 +00:00
|
|
|
it( 'highlights matching bracket', async () => {
|
2023-04-03 17:14:23 +00:00
|
|
|
await EditPage.cursorToPosition( 0 );
|
|
|
|
assert.strictEqual( await EditPage.getHighlightedMatchingBrackets(), '[]' );
|
2020-12-18 16:32:22 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-14 11:51:53 +00:00
|
|
|
it( 'matches according to cursor movement', async () => {
|
2023-04-03 17:14:23 +00:00
|
|
|
await EditPage.cursorToPosition( 3 );
|
|
|
|
assert.strictEqual( await EditPage.getHighlightedMatchingBrackets(), '{}' );
|
2020-12-18 16:32:22 +00:00
|
|
|
} );
|
|
|
|
} );
|