some fixes for editor reopen with another type

This commit is contained in:
rebornix
2020-05-15 14:11:02 -07:00
parent 80e9c11651
commit f560b157c6
2 changed files with 36 additions and 2 deletions

View File

@@ -396,6 +396,8 @@ suite('metadata', () => {
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.metadata.custom!['testCellMetadata'] as number, 123);
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
});
// TODO copy cell should not copy metadata
});
suite('regression', () => {
@@ -407,6 +409,8 @@ suite('regression', () => {
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.source, '');
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
await vscode.commands.executeCommand('workbench.action.files.saveAll');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
test('#97830, #97764. Support switch to other editor types', async function () {
@@ -427,6 +431,27 @@ suite('regression', () => {
await vscode.commands.executeCommand('workbench.action.files.saveAll');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
// open text editor, pin, and then open a notebook
test('#96105 - dirty editors', async function () {
const resource = vscode.Uri.parse(join(vscode.workspace.rootPath || '', './empty.vsctestnb'));
await vscode.commands.executeCommand('vscode.openWith', resource, 'default');
await waitFor(500);
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
// now it's dirty, open the resource with notebook editor should open a new one
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
await waitFor(500);
assert.notEqual(vscode.notebook.activeNotebookEditor, undefined, 'notebook first');
assert.notEqual(vscode.window.activeTextEditor, undefined);
// await vscode.commands.executeCommand('workbench.action.files.saveAll');
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
});
});
suite('webview resource uri', () => {