fix(wizard): an empty token box asks for a token instead of showing a raw error #173
No files matched your search
@@ -280,6 +280,26 @@ public sealed class AccountWizardViewModelTests : IDisposable
|
||||
|
||||
|
||||
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public async Task TryAdvance_WithNoTokenTyped_AsksForOne_AndAsksNothingOfTheServer(string typed)
|
||||
{
|
||||
AccountWizardViewModel wizard = NewWizard();
|
||||
wizard.Name = "Work";
|
||||
await AdvanceToStepAsync(wizard, 2);
|
||||
wizard.Token = typed;
|
||||
|
||||
Assert.False(await wizard.TryAdvanceAsync());
|
||||
|
||||
Assert.Equal(2, wizard.Step);
|
||||
Assert.Equal("Enter a token to continue.", wizard.TokenError);
|
||||
Assert.False(wizard.IsValidatingToken);
|
||||
Assert.Equal(0, _orgs.Calls);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task TryAdvance_RejectedToken_SetsTokenErrorAndStays()
|
||||
{
|
||||
|
||||
@@ -368,6 +368,13 @@ public sealed partial class AccountWizardViewModel : ObservableObject
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(candidate.Length == 0)
|
||||
{
|
||||
// Nothing to check: say so here, instead of asking the server
|
||||
// and showing its argument error (#172).
|
||||
TokenError = "Enter a token to continue.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
IsValidatingToken = true;
|
||||
|
||||
Reference in new issue
Block a user