@@ -396,6 +396,8 @@ suite('metadata', () => {
396396 assert . equal ( vscode . notebook . activeNotebookEditor ! . selection ?. metadata . custom ! [ 'testCellMetadata' ] as number , 123 ) ;
397397 assert . equal ( vscode . notebook . activeNotebookEditor ! . selection ?. language , 'typescript' ) ;
398398 } ) ;
399+
400+ // TODO copy cell should not copy metadata
399401} ) ;
400402
401403suite ( 'regression' , ( ) => {
@@ -407,6 +409,8 @@ suite('regression', () => {
407409 assert . equal ( vscode . notebook . activeNotebookEditor !== undefined , true , 'notebook first' ) ;
408410 assert . equal ( vscode . notebook . activeNotebookEditor ! . selection ?. source , '' ) ;
409411 assert . equal ( vscode . notebook . activeNotebookEditor ! . selection ?. language , 'typescript' ) ;
412+ await vscode . commands . executeCommand ( 'workbench.action.files.saveAll' ) ;
413+ await vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ;
410414 } ) ;
411415
412416 test ( '#97830, #97764. Support switch to other editor types' , async function ( ) {
@@ -427,6 +431,27 @@ suite('regression', () => {
427431 await vscode . commands . executeCommand ( 'workbench.action.files.saveAll' ) ;
428432 await vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ;
429433 } ) ;
434+
435+ // open text editor, pin, and then open a notebook
436+ test ( '#96105 - dirty editors' , async function ( ) {
437+ const resource = vscode . Uri . parse ( join ( vscode . workspace . rootPath || '' , './empty.vsctestnb' ) ) ;
438+ await vscode . commands . executeCommand ( 'vscode.openWith' , resource , 'default' ) ;
439+
440+ await waitFor ( 500 ) ;
441+ await vscode . commands . executeCommand ( 'notebook.cell.insertCodeCellBelow' ) ;
442+ await vscode . commands . executeCommand ( 'default:type' , { text : 'var abc = 0;' } ) ;
443+
444+ // now it's dirty, open the resource with notebook editor should open a new one
445+ await vscode . commands . executeCommand ( 'vscode.openWith' , resource , 'notebookCoreTest' ) ;
446+ await waitFor ( 500 ) ;
447+
448+ assert . notEqual ( vscode . notebook . activeNotebookEditor , undefined , 'notebook first' ) ;
449+ assert . notEqual ( vscode . window . activeTextEditor , undefined ) ;
450+
451+ // await vscode.commands.executeCommand('workbench.action.files.saveAll');
452+ await vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ;
453+ } ) ;
454+
430455} ) ;
431456
432457suite ( 'webview resource uri' , ( ) => {
0 commit comments