mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:28:52 +01:00
fix(notebook): redo cell creation does not re-select the cell
This commit is contained in:
@@ -308,6 +308,25 @@ suite('Notebook API tests', function () {
|
||||
assert.strictEqual(count, 0);
|
||||
});
|
||||
|
||||
test('correct cell selection on undo/redo of cell creation', async function () {
|
||||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
await vscode.commands.executeCommand('notebook.cell.insertCodeCellBelow');
|
||||
await vscode.commands.executeCommand('undo');
|
||||
const selectionUndo = [...vscode.window.activeNotebookEditor!.selections];
|
||||
await vscode.commands.executeCommand('redo');
|
||||
const selectionRedo = vscode.window.activeNotebookEditor!.selections;
|
||||
|
||||
// On undo, the selected cell must be the upper cell, ie the first one
|
||||
assert.strictEqual(selectionUndo.length, 1);
|
||||
assert.strictEqual(selectionUndo[0].start, 0);
|
||||
assert.strictEqual(selectionUndo[0].end, 1);
|
||||
// On redo, the selected cell must be the new cell, ie the second one
|
||||
assert.strictEqual(selectionRedo.length, 1);
|
||||
assert.strictEqual(selectionRedo[0].start, 1);
|
||||
assert.strictEqual(selectionRedo[0].end, 2);
|
||||
});
|
||||
|
||||
test('editor editing event 2', async function () {
|
||||
const resource = await createRandomFile('', undefined, '.vsctestnb');
|
||||
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
|
||||
|
||||
Reference in New Issue
Block a user