mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Replacing select with focus in OE (#21954)
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user