Skip to content

Commit 6c67fec

Browse files
committed
💂 test for join cells.
1 parent 9df3fcd commit 6c67fec

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

extensions/vscode-notebook-tests/src/notebook.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,27 @@ suite('notebook workflow', () => {
438438
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
439439
});
440440

441+
test('notebook join cells', async function () {
442+
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
443+
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
444+
assert.equal(vscode.notebook.activeNotebookEditor !== undefined, true, 'notebook first');
445+
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), 'test');
446+
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.language, 'typescript');
447+
448+
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
449+
assert.equal(vscode.notebook.activeNotebookEditor!.selection?.document.getText(), '');
450+
await vscode.commands.executeCommand('default:type', { text: 'var abc = 0;' });
451+
452+
const cellsChangeEvent = getEventOncePromise<vscode.NotebookCellsChangeEvent>(vscode.notebook.onDidChangeNotebookCells);
453+
await vscode.commands.executeCommand('notebook.cell.joinAbove');
454+
await cellsChangeEvent;
455+
456+
assert.deepEqual(vscode.notebook.activeNotebookEditor!.selection?.document.getText().split(/\r|\n|\r\n/), ['test', 'var abc = 0;']);
457+
458+
await vscode.commands.executeCommand('workbench.action.files.save');
459+
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');
460+
});
461+
441462
test('move cells will not recreate cells in ExtHost', async function () {
442463
const resource = vscode.Uri.file(join(vscode.workspace.rootPath || '', './first.vsctestnb'));
443464
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');

0 commit comments

Comments
 (0)