@@ -238,8 +238,29 @@ suite('API tests', () => {
238238 await vscode . commands . executeCommand ( 'workbench.action.splitEditor' ) ;
239239 await firstEditorDeactivate ;
240240
241+ await vscode . commands . executeCommand ( 'workbench.action.files.save' ) ;
241242 await vscode . commands . executeCommand ( 'workbench.action.closeAllEditors' ) ;
242243 } ) ;
244+
245+ test ( 'edit API' , async function ( ) {
246+ const resource = vscode . Uri . parse ( join ( vscode . workspace . rootPath || '' , './first.vsctestnb' ) ) ;
247+ await vscode . commands . executeCommand ( 'vscode.openWith' , resource , 'notebookCoreTest' ) ;
248+
249+ const cellsChangeEvent = getEventOncePromise < vscode . NotebookCellsChangeEvent > ( vscode . notebook . onDidChangeNotebookCells ) ;
250+ await vscode . notebook . activeNotebookEditor ! . edit ( editBuilder => {
251+ editBuilder . insert ( 1 , 'test 2' , 'javascript' , vscode . CellKind . Code , [ ] , undefined ) ;
252+ } ) ;
253+
254+ const cellChangeEventRet = await cellsChangeEvent ;
255+ assert . equal ( cellChangeEventRet . document , vscode . notebook . activeNotebookEditor ?. document ) ;
256+ assert . equal ( cellChangeEventRet . changes . length , 1 ) ;
257+ assert . deepEqual ( cellChangeEventRet . changes [ 0 ] . start , 1 ) ;
258+ assert . deepEqual ( cellChangeEventRet . changes [ 0 ] . deletedCount , 0 ) ;
259+ assert . equal ( cellChangeEventRet . changes [ 0 ] . items [ 0 ] , vscode . notebook . activeNotebookEditor ! . document . cells [ 1 ] ) ;
260+
261+ await vscode . commands . executeCommand ( 'workbench.action.files.save' ) ;
262+ await vscode . commands . executeCommand ( 'workbench.action.closeActiveEditor' ) ;
263+ } ) ;
243264} ) ;
244265
245266suite ( 'notebook workflow' , ( ) => {
@@ -459,7 +480,7 @@ suite('notebook dirty state', () => {
459480} ) ;
460481
461482suite ( 'notebook undo redo' , ( ) => {
462- test ( 'notebook open' , async function ( ) {
483+ test . skip ( 'notebook open' , async function ( ) {
463484 const resource = vscode . Uri . parse ( join ( vscode . workspace . rootPath || '' , './first.vsctestnb' ) ) ;
464485 await vscode . commands . executeCommand ( 'vscode.openWith' , resource , 'notebookCoreTest' ) ;
465486 assert . equal ( vscode . notebook . activeNotebookEditor !== undefined , true , 'notebook first' ) ;
0 commit comments