File tree Expand file tree Collapse file tree
extensions/vscode-notebook-tests/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,6 +119,27 @@ suite('Notebook API tests', () => {
119119 await vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ;
120120 } ) ;
121121
122+ test ( 'notebook open/close, notebook ready when cell-document open event is fired' , async function ( ) {
123+ const resource = vscode . Uri . file ( join ( vscode . workspace . rootPath || '' , './first.vsctestnb' ) ) ;
124+ let didHappen = false ;
125+ const p = getEventOncePromise ( vscode . workspace . onDidOpenTextDocument ) . then ( doc => {
126+ if ( doc . uri . scheme !== 'vscode-notebook-cell' ) {
127+ return ;
128+ }
129+ const notebook = vscode . notebook . notebookDocuments . find ( notebook => {
130+ const cell = notebook . cells . find ( cell => cell . document === doc ) ;
131+ return Boolean ( cell ) ;
132+ } ) ;
133+ assert . ok ( notebook , `notebook for cell ${ doc . uri } NOT found` ) ;
134+ didHappen = true ;
135+ } ) ;
136+
137+ await vscode . commands . executeCommand ( 'vscode.openWith' , resource , 'notebookCoreTest' ) ;
138+ await p ;
139+ assert . strictEqual ( didHappen , true ) ;
140+ await vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ;
141+ } ) ;
142+
122143 test ( 'shared document in notebook editors' , async function ( ) {
123144 const resource = vscode . Uri . file ( join ( vscode . workspace . rootPath || '' , './first.vsctestnb' ) ) ;
124145 let counter = 0 ;
You can’t perform that action at this time.
0 commit comments