Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 82cdf6a

Browse files
committed
Show URL tab by default when URL is in clipboard
1 parent 126a9d2 commit 82cdf6a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/GitHub.App/ViewModels/Dialog/Clone/RepositoryCloneViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ public async Task InitializeAsync(IConnection connection)
137137

138138
this.WhenAnyValue(x => x.SelectedTabIndex).Subscribe(x => tabs[x].Activate().Forget());
139139

140-
// Users in group A will see the URL tab by default
141-
if (await IsGroupA().ConfigureAwait(false))
140+
// When a clipboard URL has been set or a user is in group A, show the URL tab by default
141+
if (!string.IsNullOrEmpty(UrlTab.Url) || await IsGroupA().ConfigureAwait(false))
142142
{
143143
SelectedTabIndex = 2;
144144
}

test/GitHub.App.UnitTests/ViewModels/Dialog/Clone/RepositoryCloneViewModelTests.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,19 @@ public async Task GitHubPage_Is_Initialized()
3535
target.EnterpriseTab.DidNotReceiveWithAnyArgs().Initialize(null);
3636
}
3737

38-
[TestCase("https://github.com", false, 0)]
39-
[TestCase("https://enterprise.com", false, 1)]
40-
[TestCase("https://github.com", true, 2, Description = "Show URL tab for GitHub connections")]
41-
[TestCase("https://enterprise.com", true, 2, Description = "Show URL tab for Enterprise connections")]
42-
public async Task Default_SelectedTabIndex_For_Group(string address, bool isGroupA, int expectTabIndex)
38+
[TestCase("https://github.com", null, false, 0)]
39+
[TestCase("https://enterprise.com", null, false, 1)]
40+
[TestCase("https://github.com", null, true, 2, Description = "Show URL tab for GitHub connections")]
41+
[TestCase("https://enterprise.com", null, true, 2, Description = "Show URL tab for Enterprise connections")]
42+
[TestCase("https://github.com", "https://github.com/github/visualstudio", false, 2)]
43+
[TestCase("https://enterprise.com", "https://enterprise.com/owner/repo", false, 2)]
44+
public async Task Default_SelectedTabIndex_For_Group(string address, string clipboardUrl, bool isGroupA, int expectTabIndex)
4345
{
4446
var cm = CreateConnectionManager(address);
4547
var connection = cm.Connections[0];
4648
var usageService = CreateUsageService(isGroupA);
4749
var target = CreateTarget(connectionManager: cm, usageService: usageService);
50+
target.UrlTab.Url = clipboardUrl;
4851

4952
await target.InitializeAsync(connection);
5053

0 commit comments

Comments
 (0)