support multiple cell ranges.

This commit is contained in:
rebornix
2021-05-07 13:12:00 -07:00
parent 3110c52a6e
commit 0568de16a8
2 changed files with 240 additions and 93 deletions

View File

@@ -674,6 +674,36 @@ suite('Notebook API tests', function () {
});
});
test('cell execute command takes arguments ICellRange[]', async () => {
const resource = await createRandomNotebookFile();
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
vscode.commands.executeCommand('notebook.cell.execute', { ranges: [{ start: 0, end: 1 }, { start: 1, end: 2 }] });
let firstCellExecuted = false;
let secondCellExecuted = false;
let resolve: () => void;
const p = new Promise<void>(r => resolve = r);
const listener = vscode.notebook.onDidChangeCellOutputs(e => {
e.cells.forEach(cell => {
if (cell.index === 0) {
firstCellExecuted = true;
}
if (cell.index === 1) {
secondCellExecuted = true;
}
});
if (firstCellExecuted && secondCellExecuted) {
resolve();
}
});
await p;
listener.dispose();
await saveAllFilesAndCloseAll(undefined);
});
test('document execute command takes arguments', async () => {
const resource = await createRandomNotebookFile();
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');