Replacing select with focus in OE (#21954)

This commit is contained in:
Aasim Khan
2023-02-15 17:27:36 -08:00
committed by GitHub
parent 69616cd221
commit 48d0aa72cc
2 changed files with 5 additions and 5 deletions

View File

@@ -294,7 +294,7 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
await this.refreshTree(); await this.refreshTree();
if (newProfile && !newProfileIsSelected) { if (newProfile && !newProfileIsSelected) {
await this._tree!.reveal(newProfile); await this._tree!.reveal(newProfile);
this._tree!.select(newProfile); this._tree.setFocus(newProfile);
} }
} }

View File

@@ -122,17 +122,17 @@ suite('ServerTreeView onAddConnectionProfile handler tests', () => {
test('onAddConnectionProfile handler selects the new profile when no profile is already selected', async () => { test('onAddConnectionProfile handler focuses the new profile when no profile is already selected', async () => {
let newProfile = <IConnectionProfile>{ let newProfile = <IConnectionProfile>{
id: 'test_connection' id: 'test_connection'
}; };
await runAddConnectionProfileHandler(undefined, newProfile); await runAddConnectionProfileHandler(undefined, newProfile);
mockRefreshTreeMethod.verify(x => x(), TypeMoq.Times.once()); mockRefreshTreeMethod.verify(x => x(), TypeMoq.Times.once());
mockTree.verify(x => x.clearSelection(), TypeMoq.Times.never()); mockTree.verify(x => x.clearSelection(), TypeMoq.Times.never());
mockTree.verify(x => x.select(TypeMoq.It.is(profile => profile === newProfile)), TypeMoq.Times.once()); mockTree.verify(x => x.setFocus(TypeMoq.It.is(profile => profile === newProfile)), TypeMoq.Times.once());
}); });
test('onAddConnectionProfile handler selects the new profile when a different profile is already selected', async () => { test('onAddConnectionProfile handler focuses the new profile when a different profile is already selected', async () => {
let oldProfile = <IConnectionProfile>{ let oldProfile = <IConnectionProfile>{
id: 'old_connection' id: 'old_connection'
}; };
@@ -142,7 +142,7 @@ suite('ServerTreeView onAddConnectionProfile handler tests', () => {
await runAddConnectionProfileHandler(oldProfile, newProfile); await runAddConnectionProfileHandler(oldProfile, newProfile);
mockRefreshTreeMethod.verify(x => x(), TypeMoq.Times.once()); mockRefreshTreeMethod.verify(x => x(), TypeMoq.Times.once());
mockTree.verify(x => x.clearSelection(), TypeMoq.Times.once()); mockTree.verify(x => x.clearSelection(), TypeMoq.Times.once());
mockTree.verify(x => x.select(TypeMoq.It.is(profile => profile === newProfile)), TypeMoq.Times.once()); mockTree.verify(x => x.setFocus(TypeMoq.It.is(profile => profile === newProfile)), TypeMoq.Times.once());
}); });
test('onAddConnectionProfile handler does not clear the selection when the new profile is already selected', async () => { test('onAddConnectionProfile handler does not clear the selection when the new profile is already selected', async () => {