mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
combine events from edits from ext host.
This commit is contained in:
@@ -238,8 +238,29 @@ suite('API tests', () => {
|
||||
await vscode.commands.executeCommand('workbench.action.splitEditor');
|
||||
await firstEditorDeactivate;
|
||||
|
||||
await vscode.commands.executeCommand('workbench.action.files.save');
|
||||
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
|
||||
});
|
||||
|
||||
test('edit API', async function () {
|
||||
const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
||||
const cellsChangeEvent = getEventOncePromise<vscode.NotebookCellsChangeEvent>(vscode.notebook.onDidChangeNotebookCells);
|
||||
await vscode.notebook.activeNotebookEditor!.edit(editBuilder => {
|
||||
editBuilder.insert(1, 'test 2', 'javascript', vscode.CellKind.Code, [], undefined);
|
||||
});
|
||||
|
||||
const cellChangeEventRet = await cellsChangeEvent;
|
||||
assert.equal(cellChangeEventRet.document, vscode.notebook.activeNotebookEditor?.document);
|
||||
assert.equal(cellChangeEventRet.changes.length, 1);
|
||||
assert.deepEqual(cellChangeEventRet.changes[0].start, 1);
|
||||
assert.deepEqual(cellChangeEventRet.changes[0].deletedCount, 0);
|
||||
assert.equal(cellChangeEventRet.changes[0].items[0], vscode.notebook.activeNotebookEditor!.document.cells[1]);
|
||||
|
||||
await vscode.commands.executeCommand('workbench.action.files.save');
|
||||
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
|
||||
});
|
||||
});
|
||||
|
||||
suite('notebook workflow', () => {
|
||||
|
||||
Reference in New Issue
Block a user