Skip to content

Commit 090d8bc

Browse files
committed
editor tests
1 parent c6d1313 commit 090d8bc

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

src/vs/workbench/services/editor/test/browser/editorService.test.ts

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -279,31 +279,30 @@ suite('EditorService', () => {
279279
assert.ok(!lastUntitledEditorFactoryEditor);
280280
assert.ok(!lastDiffEditorFactoryEditor);
281281

282-
// TODO@bpasero https://github.com/microsoft/vscode/issues/127310
283282
// opening the same editor should not create
284283
// a new editor input
285-
// await openEditor(untypedEditor);
286-
// assert.strictEqual(pane?.group.activeEditor, typedEditor);
287-
//
284+
await openEditor(untypedEditor);
285+
assert.strictEqual(pane?.group.activeEditor, typedEditor);
286+
288287
// replaceEditors should work too
289-
// let untypedEditorReplacement: IResourceEditorInput = { resource: URI.file('file-replaced.editor-service-override-tests') };
290-
// await service.replaceEditors([{
291-
// editor: typedEditor,
292-
// replacement: untypedEditorReplacement
293-
// }], rootGroup);
288+
let untypedEditorReplacement: IResourceEditorInput = { resource: URI.file('file-replaced.editor-service-override-tests') };
289+
await service.replaceEditors([{
290+
editor: typedEditor,
291+
replacement: untypedEditorReplacement
292+
}], rootGroup);
294293

295-
// typedEditor = rootGroup.activeEditor!;
294+
typedEditor = rootGroup.activeEditor!;
296295

297-
// assert.ok(typedEditor instanceof TestFileEditorInput);
298-
// assert.strictEqual(typedEditor?.resource?.toString(), untypedEditorReplacement.resource.toString());
296+
assert.ok(typedEditor instanceof TestFileEditorInput);
297+
assert.strictEqual(typedEditor?.resource?.toString(), untypedEditorReplacement.resource.toString());
299298

300-
// assert.strictEqual(editorFactoryCalled, 2);
301-
// assert.strictEqual(untitledEditorFactoryCalled, 0);
302-
// assert.strictEqual(diffEditorFactoryCalled, 0);
299+
assert.strictEqual(editorFactoryCalled, 2);
300+
assert.strictEqual(untitledEditorFactoryCalled, 0);
301+
assert.strictEqual(diffEditorFactoryCalled, 0);
303302

304-
// assert.strictEqual(lastEditorFactoryEditor, untypedEditorReplacement);
305-
// assert.ok(!lastUntitledEditorFactoryEditor);
306-
// assert.ok(!lastDiffEditorFactoryEditor);
303+
assert.strictEqual(lastEditorFactoryEditor, untypedEditorReplacement);
304+
assert.ok(!lastUntitledEditorFactoryEditor);
305+
assert.ok(!lastDiffEditorFactoryEditor);
307306

308307
await resetTestState();
309308
}
@@ -329,7 +328,7 @@ suite('EditorService', () => {
329328
// opening the same editor should not create
330329
// a new editor input
331330
await openEditor(untypedEditor);
332-
// assert.strictEqual(pane?.group.activeEditor, typedEditor); // TODO@bpasero https://github.com/microsoft/vscode/issues/127310
331+
assert.strictEqual(pane?.group.activeEditor, typedEditor);
333332

334333
await resetTestState();
335334
}
@@ -505,30 +504,30 @@ suite('EditorService', () => {
505504
assert.ok(!lastUntitledEditorFactoryEditor);
506505
assert.ok(!lastDiffEditorFactoryEditor);
507506

508-
// // TODO@bpasero https://github.com/microsoft/vscode/issues/127310
509507
// opening the same editor should not create
510508
// a new editor input
511-
// await openEditor(typedEditor);
512-
// assert.strictEqual(pane?.group.activeEditor, typedEditor);
509+
await openEditor(typedEditor);
510+
assert.strictEqual(pane?.group.activeEditor, typedInput);
511+
513512
// replaceEditors should work too
514-
// let typedEditorReplacement = new TestFileEditorInput(URI.file('file-replaced.editor-service-override-tests'), TEST_EDITOR_INPUT_ID);
515-
// await service.replaceEditors([{
516-
// editor: typedEditor,
517-
// replacement: typedEditorReplacement
518-
// }], rootGroup);
513+
let typedEditorReplacement = new TestFileEditorInput(URI.file('file-replaced.editor-service-override-tests'), TEST_EDITOR_INPUT_ID);
514+
await service.replaceEditors([{
515+
editor: typedEditor,
516+
replacement: typedEditorReplacement
517+
}], rootGroup);
519518

520-
// typedInput = rootGroup.activeEditor!;
519+
typedInput = rootGroup.activeEditor!;
521520

522-
// assert.ok(typedInput instanceof TestFileEditorInput);
523-
// assert.strictEqual(typedInput.resource.toString(), typedEditorReplacement.resource.toString());
521+
assert.ok(typedInput instanceof TestFileEditorInput);
522+
assert.strictEqual(typedInput.resource.toString(), typedEditorReplacement.resource.toString());
524523

525-
// assert.strictEqual(editorFactoryCalled, 2);
526-
// assert.strictEqual(untitledEditorFactoryCalled, 0);
527-
// assert.strictEqual(diffEditorFactoryCalled, 0);
524+
assert.strictEqual(editorFactoryCalled, 2);
525+
assert.strictEqual(untitledEditorFactoryCalled, 0);
526+
assert.strictEqual(diffEditorFactoryCalled, 0);
528527

529-
// assert.strictEqual((lastEditorFactoryEditor as IResourceEditorInput).resource.toString(), typedInput.resource.toString());
530-
// assert.ok(!lastUntitledEditorFactoryEditor);
531-
// assert.ok(!lastDiffEditorFactoryEditor);
528+
assert.strictEqual((lastEditorFactoryEditor as IResourceEditorInput).resource.toString(), typedInput.resource.toString());
529+
assert.ok(!lastUntitledEditorFactoryEditor);
530+
assert.ok(!lastDiffEditorFactoryEditor);
532531

533532
await resetTestState();
534533
}
@@ -554,7 +553,7 @@ suite('EditorService', () => {
554553
// opening the same editor should not create
555554
// a new editor input
556555
await openEditor(typedEditor);
557-
// assert.strictEqual(pane?.group.activeEditor, typedEditor); // TODO@bpasero https://github.com/microsoft/vscode/issues/127310
556+
assert.strictEqual(pane?.group.activeEditor, typedEditor);
558557

559558
await resetTestState();
560559
}
@@ -774,7 +773,7 @@ suite('EditorService', () => {
774773
// opening the same editor should not create
775774
// a new editor input
776775
await openEditor(untypedEditor);
777-
// assert.strictEqual(pane?.group.activeEditor, typedEditor); // TODO@bpasero https://github.com/microsoft/vscode/issues/127310
776+
assert.strictEqual(pane?.group.activeEditor, typedEditor);
778777

779778
await resetTestState();
780779
}

0 commit comments

Comments
 (0)