Skip to content

Commit 7cb10c3

Browse files
authored
Show empty state in experiments tree when there are no columns (#1777)
* show an empty state in the experiments tree when there are no columns in the project * reword test
1 parent 644d8ec commit 7cb10c3

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

extension/src/experiments/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,10 @@ export class Experiments extends BaseRepository<TableData> {
320320
}
321321

322322
public getExperiments() {
323+
if (!this.columns.hasColumns()) {
324+
return []
325+
}
326+
323327
return this.experiments.getExperiments()
324328
}
325329

@@ -332,6 +336,10 @@ export class Experiments extends BaseRepository<TableData> {
332336
}
333337

334338
public getSelectedRevisions() {
339+
if (!this.columns.hasColumns()) {
340+
return []
341+
}
342+
335343
return this.experiments.getSelectedRevisions()
336344
}
337345

extension/src/test/suite/experiments/index.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ suite('Experiments Test Suite', () => {
601601
'queued experiment cannot be selected'
602602
).to.be.false
603603
})
604+
604605
it('should be able to handle a message to select columns', async () => {
605606
const { columnsModel, experiments, messageSpy } =
606607
setupExperimentsAndMockCommands()
@@ -1150,4 +1151,35 @@ suite('Experiments Test Suite', () => {
11501151
expect(setContextValueSpy).not.to.be.called
11511152
})
11521153
})
1154+
1155+
describe('Empty repository', () => {
1156+
it('should not show any experiments in the experiments tree when there are no columns', async () => {
1157+
const { experiments } = buildExperiments(disposable, {
1158+
b9f016df00d499f6d2a73e7dc34d1600c78066eb: {
1159+
baseline: {
1160+
data: {
1161+
deps: {}
1162+
}
1163+
}
1164+
},
1165+
workspace: {
1166+
baseline: {
1167+
data: {
1168+
deps: {}
1169+
}
1170+
}
1171+
}
1172+
})
1173+
await experiments.isReady()
1174+
1175+
expect(
1176+
experiments.getExperiments(),
1177+
'should send no experiments to the tree'
1178+
).to.deep.equal([])
1179+
expect(
1180+
experiments.getSelectedRevisions(),
1181+
'should show 0 selected experiments as selected in the description'
1182+
).to.deep.equal([])
1183+
})
1184+
})
11531185
})

0 commit comments

Comments
 (0)