Родитель
975e05cd1c
Коммит
8d1d1373cd
|
@ -58,8 +58,8 @@ interface EditContextEventHandlersEventMap {
|
|||
|
||||
type EventHandler<TEvent extends Event = Event> = (event: TEvent) => void;
|
||||
|
||||
declare class TextUpdateEvent extends Event {
|
||||
constructor(type: DOMString, options?: TextUpdateEventInit);
|
||||
interface TextUpdateEvent extends Event {
|
||||
new(type: DOMString, options?: TextUpdateEventInit): TextUpdateEvent;
|
||||
|
||||
readonly updateRangeStart: number;
|
||||
readonly updateRangeEnd: number;
|
||||
|
|
|
@ -5749,7 +5749,7 @@ export const EditorOptions = {
|
|||
emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),
|
||||
dropIntoEditor: register(new EditorDropIntoEditor()),
|
||||
experimentalEditContextEnabled: register(new EditorBooleanOption(
|
||||
EditorOption.experimentalEditContextEnabled, 'experimentalEditContextEnabled', true,
|
||||
EditorOption.experimentalEditContextEnabled, 'experimentalEditContextEnabled', false,
|
||||
{
|
||||
description: nls.localize('experimentalEditContextEnabled', "Sets whether the new experimental edit context should be used instead of the text area."),
|
||||
included: platform.isChrome || platform.isEdge || platform.isNative
|
||||
|
|
|
@ -134,23 +134,17 @@ export class BrowserWindowDriver implements IWindowDriver {
|
|||
throw new Error(`Editor not found: ${selector}`);
|
||||
}
|
||||
|
||||
const divElement = element as HTMLDivElement;
|
||||
const editContext = divElement.editContext;
|
||||
if (!editContext) {
|
||||
throw new Error(`Edit context not found: ${selector}`);
|
||||
}
|
||||
const selectionStart = editContext.selectionStart;
|
||||
const selectionEnd = editContext.selectionEnd;
|
||||
const event = new TextUpdateEvent('textupdate', {
|
||||
updateRangeStart: selectionStart,
|
||||
updateRangeEnd: selectionEnd,
|
||||
text,
|
||||
selectionStart: selectionStart + text.length,
|
||||
selectionEnd: selectionStart + text.length,
|
||||
compositionStart: 0,
|
||||
compositionEnd: 0
|
||||
});
|
||||
editContext.dispatchEvent(event);
|
||||
const textarea = element as HTMLTextAreaElement;
|
||||
const start = textarea.selectionStart;
|
||||
const newStart = start + text.length;
|
||||
const value = textarea.value;
|
||||
const newValue = value.substr(0, start) + text + value.substr(start);
|
||||
|
||||
textarea.value = newValue;
|
||||
textarea.setSelectionRange(newStart, newStart);
|
||||
|
||||
const event = new Event('input', { 'bubbles': true, 'cancelable': true });
|
||||
textarea.dispatchEvent(event);
|
||||
}
|
||||
|
||||
async getTerminalBuffer(selector: string): Promise<string[]> {
|
||||
|
|
|
@ -31,7 +31,7 @@ const CONSOLE_OUTPUT = `.repl .output.expression .value`;
|
|||
const CONSOLE_EVALUATION_RESULT = `.repl .evaluation-result.expression .value`;
|
||||
const CONSOLE_LINK = `.repl .value a.link`;
|
||||
|
||||
const REPL_FOCUSED = '.repl-input-wrapper .monaco-editor .native-edit-context';
|
||||
const REPL_FOCUSED = '.repl-input-wrapper .monaco-editor textarea';
|
||||
|
||||
export interface IStackFrame {
|
||||
name: string;
|
||||
|
|
|
@ -78,10 +78,10 @@ export class Editor {
|
|||
async waitForEditorFocus(filename: string, lineNumber: number, selectorPrefix = ''): Promise<void> {
|
||||
const editor = [selectorPrefix || '', EDITOR(filename)].join(' ');
|
||||
const line = `${editor} .view-lines > .view-line:nth-child(${lineNumber})`;
|
||||
const editContext = `${editor} .native-edit-context`;
|
||||
const textarea = `${editor} textarea`;
|
||||
|
||||
await this.code.waitAndClick(line, 1, 1);
|
||||
await this.code.waitForActiveElement(editContext);
|
||||
await this.code.waitForActiveElement(textarea);
|
||||
}
|
||||
|
||||
async waitForTypeInEditor(filename: string, text: string, selectorPrefix = ''): Promise<any> {
|
||||
|
@ -92,10 +92,10 @@ export class Editor {
|
|||
|
||||
await this.code.waitForElement(editor);
|
||||
|
||||
const editContext = `${editor} .native-edit-context`;
|
||||
await this.code.waitForActiveElement(editContext);
|
||||
const textarea = `${editor} textarea`;
|
||||
await this.code.waitForActiveElement(textarea);
|
||||
|
||||
await this.code.waitForTypeInEditor(editContext, text);
|
||||
await this.code.waitForTypeInEditor(textarea, text);
|
||||
|
||||
await this.waitForEditorContents(filename, c => c.indexOf(text) > -1, selectorPrefix);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ export class Editors {
|
|||
}
|
||||
|
||||
async waitForActiveEditor(fileName: string, retryCount?: number): Promise<any> {
|
||||
const selector = `.editor-instance .monaco-editor[data-uri$="${fileName}"] .native-edit-context`;
|
||||
const selector = `.editor-instance .monaco-editor[data-uri$="${fileName}"] textarea`;
|
||||
return this.code.waitForActiveElement(selector, retryCount);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ export class Extensions extends Viewlet {
|
|||
|
||||
async searchForExtension(id: string): Promise<any> {
|
||||
await this.commands.runCommand('Extensions: Focus on Extensions View', { exactLabelMatch: true });
|
||||
await this.code.waitForTypeInEditor('div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor .native-edit-context', `@id:${id}`);
|
||||
await this.code.waitForTypeInEditor('div.extensions-viewlet[id="workbench.view.extensions"] .monaco-editor textarea', `@id:${id}`);
|
||||
await this.code.waitForTextContent(`div.part.sidebar div.composite.title h2`, 'Extensions: Marketplace');
|
||||
|
||||
let retrials = 1;
|
||||
|
|
|
@ -46,10 +46,10 @@ export class Notebook {
|
|||
|
||||
await this.code.waitForElement(editor);
|
||||
|
||||
const editContext = `${editor} .native-edit-context`;
|
||||
await this.code.waitForActiveElement(editContext);
|
||||
const textarea = `${editor} textarea`;
|
||||
await this.code.waitForActiveElement(textarea);
|
||||
|
||||
await this.code.waitForTypeInEditor(editContext, text);
|
||||
await this.code.waitForTypeInEditor(textarea, text);
|
||||
|
||||
await this._waitForActiveCellEditorContents(c => c.indexOf(text) > -1);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { IElement } from './driver';
|
|||
import { findElement, findElements, Code } from './code';
|
||||
|
||||
const VIEWLET = 'div[id="workbench.view.scm"]';
|
||||
const SCM_INPUT = `${VIEWLET} .scm-editor .native-edit-context`;
|
||||
const SCM_INPUT = `${VIEWLET} .scm-editor textarea`;
|
||||
const SCM_RESOURCE = `${VIEWLET} .monaco-list-row .resource`;
|
||||
const REFRESH_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[aria-label="Refresh"]`;
|
||||
const COMMIT_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[aria-label="Commit"]`;
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Editors } from './editors';
|
|||
import { Code } from './code';
|
||||
import { QuickAccess } from './quickaccess';
|
||||
|
||||
const SEARCH_BOX = '.settings-editor .suggest-input-container .monaco-editor .native-edit-context';
|
||||
const SEARCH_BOX = '.settings-editor .suggest-input-container .monaco-editor textarea';
|
||||
|
||||
export class SettingsEditor {
|
||||
constructor(private code: Code, private editors: Editors, private editor: Editor, private quickaccess: QuickAccess) { }
|
||||
|
@ -71,7 +71,7 @@ export class SettingsEditor {
|
|||
}
|
||||
await this.code.dispatchKeybinding('Delete');
|
||||
await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => !results || (results?.length === 1 && !results[0].textContent));
|
||||
await this.code.waitForTypeInEditor('.settings-editor .suggest-input-container .monaco-editor .native-edit-context', query);
|
||||
await this.code.waitForTypeInEditor('.settings-editor .suggest-input-container .monaco-editor textarea', query);
|
||||
await this.code.waitForElements('.settings-editor .settings-count-widget', false, results => results?.length === 1 && results[0].textContent.includes('Found'));
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче