testing: fix welcome view being shown incorrectly
Fixes https://github.com/microsoft/vscode/issues/119675
This commit is contained in:
parent
7770708545
commit
968d670266
3 changed files with 25 additions and 12 deletions
|
@ -353,7 +353,8 @@ export class SingleUseTestCollection implements IDisposable {
|
|||
|
||||
const parentId = parent ? parent.item.extId : null;
|
||||
const expand = actual.resolveHandler ? TestItemExpandState.Expandable : TestItemExpandState.NotExpandable;
|
||||
const pExpandLvls = parent?.expandLevels;
|
||||
// always expand root node to know if there are tests (and whether to show the welcome view)
|
||||
const pExpandLvls = parent ? parent.expandLevels : 1;
|
||||
const src = { controller: controllerId, tree: this.testIdToInternal.object.id };
|
||||
const internal: OwnedCollectionTestItem = {
|
||||
actual,
|
||||
|
|
|
@ -83,6 +83,7 @@ export class TestTreeTestHarness<T extends ITestTreeProjection = ITestTreeProjec
|
|||
private readonly onDiff = this._register(new Emitter<[IWorkspaceFolderData, TestsDiff]>());
|
||||
public readonly onFolderChange = this._register(new Emitter<IWorkspaceFoldersChangeEvent>());
|
||||
public readonly c: TestSingleUseCollection = this._register(this.owned.createForHierarchy(d => this.c.setDiff(d /* don't clear during testing */)));
|
||||
private isProcessingDiff = false;
|
||||
public readonly projection: T;
|
||||
public readonly tree: TestObjectTree<TestExplorerTreeElement>;
|
||||
|
||||
|
@ -92,7 +93,9 @@ export class TestTreeTestHarness<T extends ITestTreeProjection = ITestTreeProjec
|
|||
workspaceFolderCollections: folders.map(folder => [{ folder }, {
|
||||
expand: (testId: string, levels: number) => {
|
||||
this.c.expand(testId, levels);
|
||||
this.onDiff.fire([folder, this.c.collectDiff()]);
|
||||
if (!this.isProcessingDiff) {
|
||||
this.onDiff.fire([folder, this.c.collectDiff()]);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
all: [],
|
||||
|
@ -109,7 +112,12 @@ export class TestTreeTestHarness<T extends ITestTreeProjection = ITestTreeProjec
|
|||
}
|
||||
|
||||
public flush(folder: IWorkspaceFolderData) {
|
||||
this.onDiff.fire([folder!, this.c.collectDiff()]);
|
||||
this.isProcessingDiff = true;
|
||||
while (this.c.currentDiff.length) {
|
||||
this.onDiff.fire([folder!, this.c.collectDiff()]);
|
||||
}
|
||||
this.isProcessingDiff = false;
|
||||
|
||||
this.projection.applyTo(this.tree);
|
||||
return this.tree.getRendered();
|
||||
}
|
||||
|
|
|
@ -82,7 +82,19 @@ suite('ExtHost Testing', () => {
|
|||
],
|
||||
[
|
||||
TestDiffOpType.Add,
|
||||
{ src: { tree: 0, controller: 'pid' }, parent: 'id-root', expand: TestItemExpandState.BusyExpanding, item: { ...convert.TestItem.from(stubTest('a')) } }
|
||||
{ src: { tree: 0, controller: 'pid' }, parent: 'id-root', expand: TestItemExpandState.Expandable, item: { ...convert.TestItem.from(stubTest('a')) } }
|
||||
],
|
||||
[
|
||||
TestDiffOpType.Add,
|
||||
{ src: { tree: 0, controller: 'pid' }, parent: 'id-root', expand: TestItemExpandState.NotExpandable, item: convert.TestItem.from(stubTest('b')) }
|
||||
],
|
||||
[
|
||||
TestDiffOpType.Update,
|
||||
{ extId: 'id-root', expand: TestItemExpandState.Expanded }
|
||||
],
|
||||
[
|
||||
TestDiffOpType.Update,
|
||||
{ extId: 'id-a', expand: TestItemExpandState.BusyExpanding }
|
||||
],
|
||||
[
|
||||
TestDiffOpType.Add,
|
||||
|
@ -96,14 +108,6 @@ suite('ExtHost Testing', () => {
|
|||
TestDiffOpType.Update,
|
||||
{ extId: 'id-a', expand: TestItemExpandState.Expanded }
|
||||
],
|
||||
[
|
||||
TestDiffOpType.Add,
|
||||
{ src: { tree: 0, controller: 'pid' }, parent: 'id-root', expand: TestItemExpandState.NotExpandable, item: convert.TestItem.from(stubTest('b')) }
|
||||
],
|
||||
[
|
||||
TestDiffOpType.Update,
|
||||
{ extId: 'id-root', expand: TestItemExpandState.Expanded }
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue