editors - add a test for the fix of #136684

This commit is contained in:
Benjamin Pasero 2021-11-10 09:34:00 +01:00
parent bef4dba21f
commit 2b03df8938
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65

View file

@ -196,6 +196,36 @@ suite('EditorService', () => {
visibleEditorChangeListener.dispose();
});
test('openEditor() - same input does not cancel previous one - https://github.com/microsoft/vscode/issues/136684', async () => {
const [, service] = await createEditorService();
let input = new TestFileEditorInput(URI.parse('my://resource-basics'), TEST_EDITOR_INPUT_ID);
let editorP1 = service.openEditor(input, { pinned: true });
let editorP2 = service.openEditor(input, { pinned: true });
let editor1 = await editorP1;
assert.strictEqual(editor1?.input, input);
let editor2 = await editorP2;
assert.strictEqual(editor2?.input, input);
assert.ok(editor2.group);
await editor2.group.closeAllEditors();
input = new TestFileEditorInput(URI.parse('my://resource-basics'), TEST_EDITOR_INPUT_ID);
let inputSame = new TestFileEditorInput(URI.parse('my://resource-basics'), TEST_EDITOR_INPUT_ID);
editorP1 = service.openEditor(input, { pinned: true });
editorP2 = service.openEditor(inputSame, { pinned: true });
editor1 = await editorP1;
assert.strictEqual(editor1?.input, input);
editor2 = await editorP2;
assert.strictEqual(editor2?.input, input);
});
test('openEditor() - locked groups', async () => {
disposables.add(registerTestFileEditor());