auto save ...
This commit is contained in:
parent
779938d5e4
commit
bd47ac847c
|
@ -297,7 +297,7 @@ suite('Notebook API tests', () => {
|
|||
document: vscode.window.activeNotebookEditor!.document,
|
||||
cells: [vscode.window.activeNotebookEditor!.document.cells[0]]
|
||||
});
|
||||
assert.strictEqual(cellOutputsAddedRet.cells[0].outputs2.length, 1);
|
||||
assert.strictEqual(cellOutputsAddedRet.cells[0].outputs.length, 1);
|
||||
|
||||
const cellOutputClear = getEventOncePromise<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs);
|
||||
await vscode.commands.executeCommand('notebook.cell.clearOutputs');
|
||||
|
@ -306,7 +306,7 @@ suite('Notebook API tests', () => {
|
|||
document: vscode.window.activeNotebookEditor!.document,
|
||||
cells: [vscode.window.activeNotebookEditor!.document.cells[0]]
|
||||
});
|
||||
assert.strictEqual(cellOutputsAddedRet.cells[0].outputs2.length, 0);
|
||||
assert.strictEqual(cellOutputsAddedRet.cells[0].outputs.length, 0);
|
||||
|
||||
// const cellChangeLanguage = getEventOncePromise<vscode.NotebookCellLanguageChangeEvent>(vscode.notebook.onDidChangeCellLanguage);
|
||||
// await vscode.commands.executeCommand('notebook.cell.changeToMarkdown');
|
||||
|
@ -447,10 +447,10 @@ suite('Notebook API tests', () => {
|
|||
const document = vscode.window.activeNotebookEditor?.document!;
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs2.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs.length, 1);
|
||||
|
||||
// consuming is OLD api (for now)
|
||||
const [output] = document.cells[0].outputs2;
|
||||
const [output] = document.cells[0].outputs;
|
||||
|
||||
assert.strictEqual(output.outputs.length, 2);
|
||||
assert.strictEqual(output.outputs[0].mime, 'application/foo');
|
||||
|
@ -475,10 +475,10 @@ suite('Notebook API tests', () => {
|
|||
const document = vscode.window.activeNotebookEditor?.document!;
|
||||
assert.strictEqual(document.isDirty, true);
|
||||
assert.strictEqual(document.cells.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs2.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs2[0].outputs.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs2[0].outputs[0].mime, 'foo');
|
||||
assert.strictEqual(document.cells[0].outputs2[0].outputs[0].value, 'bar');
|
||||
assert.strictEqual(document.cells[0].outputs.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs[0].outputs.length, 1);
|
||||
assert.strictEqual(document.cells[0].outputs[0].outputs[0].mime, 'foo');
|
||||
assert.strictEqual(document.cells[0].outputs[0].outputs[0].value, 'bar');
|
||||
|
||||
await saveAllFilesAndCloseAll(undefined);
|
||||
});
|
||||
|
@ -500,10 +500,10 @@ suite('Notebook API tests', () => {
|
|||
assert.strictEqual(value.document.isDirty, true);
|
||||
assert.strictEqual(value.cells.length, 1);
|
||||
assert.strictEqual(value.document.cells.length, 1);
|
||||
assert.strictEqual(value.document.cells[0].outputs2.length, 1);
|
||||
assert.strictEqual(value.document.cells[0].outputs2[0].outputs.length, 1);
|
||||
assert.strictEqual(value.document.cells[0].outputs2[0].outputs[0].mime, 'foo');
|
||||
assert.strictEqual(value.document.cells[0].outputs2[0].outputs[0].value, 'bar');
|
||||
assert.strictEqual(value.document.cells[0].outputs.length, 1);
|
||||
assert.strictEqual(value.document.cells[0].outputs[0].outputs.length, 1);
|
||||
assert.strictEqual(value.document.cells[0].outputs[0].outputs[0].mime, 'foo');
|
||||
assert.strictEqual(value.document.cells[0].outputs[0].outputs[0].value, 'bar');
|
||||
|
||||
await saveAllFilesAndCloseAll(undefined);
|
||||
});
|
||||
|
@ -916,21 +916,21 @@ suite('notebook workflow', () => {
|
|||
|
||||
await vscode.commands.executeCommand('notebook.focusTop');
|
||||
const cell = editor.document.cells[0];
|
||||
assert.strictEqual(cell.outputs2.length, 0);
|
||||
assert.strictEqual(cell.outputs.length, 0);
|
||||
|
||||
let metadataChangeEvent = getEventOncePromise<vscode.NotebookCellMetadataChangeEvent>(vscode.notebook.onDidChangeCellMetadata);
|
||||
await updateCellMetadata(resource, cell, { ...cell.metadata, runnable: false });
|
||||
await metadataChangeEvent;
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.execute');
|
||||
assert.strictEqual(cell.outputs2.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
assert.strictEqual(cell.outputs.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
|
||||
metadataChangeEvent = getEventOncePromise<vscode.NotebookCellMetadataChangeEvent>(vscode.notebook.onDidChangeCellMetadata);
|
||||
await updateCellMetadata(resource, cell, { ...cell.metadata, runnable: true });
|
||||
await metadataChangeEvent;
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.execute');
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
|
||||
await vscode.commands.executeCommand('workbench.action.files.save');
|
||||
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
|
||||
|
@ -944,7 +944,7 @@ suite('notebook workflow', () => {
|
|||
const editor = vscode.window.activeNotebookEditor!;
|
||||
|
||||
const cell = editor.document.cells[0];
|
||||
assert.strictEqual(cell.outputs2.length, 0);
|
||||
assert.strictEqual(cell.outputs.length, 0);
|
||||
|
||||
await withEvent(vscode.notebook.onDidChangeNotebookDocumentMetadata, async event => {
|
||||
updateNotebookMetadata(editor.document.uri, { ...editor.document.metadata, runnable: false });
|
||||
|
@ -952,7 +952,7 @@ suite('notebook workflow', () => {
|
|||
});
|
||||
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
assert.strictEqual(cell.outputs2.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
assert.strictEqual(cell.outputs.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
|
||||
await withEvent(vscode.notebook.onDidChangeNotebookDocumentMetadata, async event => {
|
||||
updateNotebookMetadata(editor.document.uri, { ...editor.document.metadata, runnable: true });
|
||||
|
@ -962,7 +962,7 @@ suite('notebook workflow', () => {
|
|||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
await event;
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
});
|
||||
|
||||
await vscode.commands.executeCommand('workbench.action.files.save');
|
||||
|
@ -980,7 +980,7 @@ suite('notebook workflow', () => {
|
|||
const cell = editor.document.cells[0];
|
||||
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
assert.strictEqual(cell.outputs2.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
assert.strictEqual(cell.outputs.length, 0, 'should not execute'); // not runnable, didn't work
|
||||
|
||||
await vscode.commands.executeCommand('workbench.action.files.save');
|
||||
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
|
||||
|
@ -1002,13 +1002,13 @@ suite('notebook workflow', () => {
|
|||
await withEvent(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
await event;
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
});
|
||||
|
||||
await withEvent(vscode.notebook.onDidChangeCellOutputs, async event => {
|
||||
await vscode.commands.executeCommand('notebook.cell.clearOutputs');
|
||||
await event;
|
||||
assert.strictEqual(cell.outputs2.length, 0, 'should clear');
|
||||
assert.strictEqual(cell.outputs.length, 0, 'should clear');
|
||||
});
|
||||
|
||||
const secondResource = await createRandomFile('', undefined, 'second', '.vsctestnb');
|
||||
|
@ -1017,7 +1017,7 @@ suite('notebook workflow', () => {
|
|||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.cell.execute', { start: 0, end: 1 }, resource);
|
||||
await event;
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.document.uri.fsPath, secondResource.fsPath);
|
||||
});
|
||||
|
||||
|
@ -1043,13 +1043,13 @@ suite('notebook workflow', () => {
|
|||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.execute');
|
||||
await event;
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
});
|
||||
|
||||
const clearChangeEvent = getEventOncePromise<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs);
|
||||
await vscode.commands.executeCommand('notebook.cell.clearOutputs');
|
||||
await clearChangeEvent;
|
||||
assert.strictEqual(cell.outputs2.length, 0, 'should clear');
|
||||
assert.strictEqual(cell.outputs.length, 0, 'should clear');
|
||||
|
||||
const secondResource = await createRandomFile('', undefined, 'second', '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', secondResource, 'notebookCoreTest');
|
||||
|
@ -1057,7 +1057,7 @@ suite('notebook workflow', () => {
|
|||
await withEvent<vscode.NotebookCellOutputsChangeEvent>(vscode.notebook.onDidChangeCellOutputs, async (event) => {
|
||||
await vscode.commands.executeCommand('notebook.execute', resource);
|
||||
await event;
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(vscode.window.activeNotebookEditor?.document.uri.fsPath, secondResource.fsPath);
|
||||
});
|
||||
|
||||
|
@ -1080,19 +1080,19 @@ suite('notebook workflow', () => {
|
|||
await metadataChangeEvent;
|
||||
|
||||
await vscode.commands.executeCommand('notebook.cell.execute');
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs2[0].outputs.length, 1);
|
||||
assert.strictEqual(cell.outputs2[0].outputs[0].mime, 'text/plain');
|
||||
assert.deepStrictEqual(cell.outputs2[0].outputs[0].value, [
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs[0].outputs.length, 1);
|
||||
assert.strictEqual(cell.outputs[0].outputs[0].mime, 'text/plain');
|
||||
assert.deepStrictEqual(cell.outputs[0].outputs[0].value, [
|
||||
'my output'
|
||||
]);
|
||||
|
||||
await vscode.commands.executeCommand('notebook.selectKernel', { extension: 'vscode.vscode-notebook-tests', id: 'secondaryKernel' });
|
||||
await vscode.commands.executeCommand('notebook.cell.execute');
|
||||
assert.strictEqual(cell.outputs2.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs2[0].outputs.length, 1);
|
||||
assert.strictEqual(cell.outputs2[0].outputs[0].mime, 'text/plain');
|
||||
assert.deepStrictEqual(cell.outputs2[0].outputs[0].value, [
|
||||
assert.strictEqual(cell.outputs.length, 1, 'should execute'); // runnable, it worked
|
||||
assert.strictEqual(cell.outputs[0].outputs.length, 1);
|
||||
assert.strictEqual(cell.outputs[0].outputs[0].mime, 'text/plain');
|
||||
assert.deepStrictEqual(cell.outputs[0].outputs[0].value, [
|
||||
'my second output'
|
||||
]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue