more tests for https://github.com/microsoft/vscode/issues/117273
This commit is contained in:
parent
a63be52fde
commit
8d9b2e65bd
2 changed files with 38 additions and 15 deletions
|
@ -351,7 +351,6 @@ suite('Notebook Document', function () {
|
|||
|
||||
|
||||
test('#117273, Add multiple outputs', async function () {
|
||||
this.skip();
|
||||
|
||||
const resource = await utils.createRandomFile(undefined, undefined, '.nbdtest');
|
||||
const document = await vscode.notebook.openNotebookDocument(resource);
|
||||
|
@ -372,26 +371,13 @@ suite('Notebook Document', function () {
|
|||
assert.deepStrictEqual(document.cells[0].outputs[0].outputs[0].metadata, { outputType: 'stream', streamName: 'stdout' });
|
||||
|
||||
const edit2 = new vscode.WorkspaceEdit();
|
||||
// All of the following edit operations fail.
|
||||
edit2.appendNotebookCellOutput(document.uri, 0, [
|
||||
new vscode.NotebookCellOutput(
|
||||
[new vscode.NotebookCellOutputItem('hello', '1', { outputType: 'stream', streamName: 'stderr' })],
|
||||
{ outputType: 'stream', streamName: 'stderr' }
|
||||
)
|
||||
]);
|
||||
// edit2.replaceNotebookCellOutput(document.uri, 0, [
|
||||
// ...document.cells[0].outputs,
|
||||
// new vscode.NotebookCellOutput([new vscode.NotebookCellOutputItem('hello', '1', { outputType: 'stream', streamName: 'stderr' })], { outputType: 'stream', streamName: 'stderr' })
|
||||
// ]);
|
||||
// edit2.replaceNotebookCellOutput(document.uri, 0, [
|
||||
// ...document.cells[0].outputs,
|
||||
// new vscode.NotebookCellOutput([new vscode.NotebookCellOutputItem('application/x.notebook.stream', '1', { outputType: 'stream', streamName: 'stderr' })], { outputType: 'stream', streamName: 'stderr' })
|
||||
// ]);
|
||||
// This wasn't working, i had to revert to using `replaceNotebookCellOutput` (could be because we had two output in the cell).
|
||||
// edit2.appendNotebookCellOutputItems(document.uri, 0, document.cells[0].outputs[1].id, [
|
||||
// new vscode.NotebookCellOutputItem('hello', 'Append to existing stderr when we have two outputs (one for stdout & one for stderr)', { outputType: 'stream', streamName: 'stderr' })
|
||||
// ]);
|
||||
success = await vscode.workspace.applyEdit(edit);
|
||||
success = await vscode.workspace.applyEdit(edit2);
|
||||
assert.ok(success);
|
||||
|
||||
assert.strictEqual(document.cells[0].outputs.length, 2);
|
||||
|
|
|
@ -351,4 +351,41 @@ suite('NotebookTextModel', () => {
|
|||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
test('Updating appending/updating output in Notebooks does not work as expected #117273', function () {
|
||||
withTestNotebook(instantiationService, blukEditService, undoRedoService, [
|
||||
['var a = 1;', 'javascript', CellKind.Code, [], { editable: true }]
|
||||
], (_editor, _view, model) => {
|
||||
|
||||
assert.strictEqual(model.cells.length, 1);
|
||||
assert.strictEqual(model.cells[0].outputs.length, 0);
|
||||
|
||||
const success1 = model.applyEdits(
|
||||
model.versionId,
|
||||
[{
|
||||
editType: CellEditType.Output, index: 0, outputs: [
|
||||
{ outputId: 'out1', outputs: [{ mime: 'application/x.notebook.stream', value: 1 }] }
|
||||
],
|
||||
append: false
|
||||
}], true, undefined, () => undefined, undefined, false
|
||||
);
|
||||
|
||||
assert.ok(success1);
|
||||
assert.strictEqual(model.cells[0].outputs.length, 1);
|
||||
|
||||
const success2 = model.applyEdits(
|
||||
model.versionId,
|
||||
[{
|
||||
editType: CellEditType.Output, index: 0, outputs: [
|
||||
{ outputId: 'out2', outputs: [{ mime: 'application/x.notebook.stream', value: 1 }] }
|
||||
],
|
||||
append: true
|
||||
}], true, undefined, () => undefined, undefined, false
|
||||
);
|
||||
|
||||
assert.ok(success2);
|
||||
assert.strictEqual(model.cells[0].outputs.length, 2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue