Skip to content

Commit

Permalink
Remove person tab in LmsLoginDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasweishaupt committed Jul 22, 2024
1 parent 759bbf0 commit 8607fd4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
40 changes: 19 additions & 21 deletions IntegrationTest/Dialogues/LmsLoginDialogIt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,13 @@ public async Task DialogCreated_LmsNotConnected_RenderLmsLoginDialogWithForm()
await OpenDialogAndGetDialogReferenceAsync();

var mudTexts = DialogProvider.FindComponents<MudText>();
Assert.That(mudTexts, Has.Count.EqualTo(5));
Assert.That(mudTexts, Has.Count.EqualTo(4));
Assert.Multiple(() =>
{
Assert.That(mudTexts[0].Markup, Contains.Substring("DialogContent.Header"));
Assert.That(mudTexts[1].Markup, Contains.Substring(""));
Assert.That(mudTexts[2].Markup, Contains.Substring(""));
Assert.That(mudTexts[3].Markup, Contains.Substring("Header.Moodle.Text"));
Assert.That(mudTexts[4].Markup, Contains.Substring("DialogContent.Button.Login"));
Assert.That(mudTexts[2].Markup, Contains.Substring("Header.Moodle.Text"));
Assert.That(mudTexts[3].Markup, Contains.Substring("DialogContent.Button.Login"));
});

var mudTextFields = DialogProvider.FindComponents<MudTextField<string>>();
Expand All @@ -91,10 +90,10 @@ public async Task DialogCreated_LmsNotConnected_RenderLmsLoginDialogWithForm()
Assert.That(mudButtons, Has.Count.EqualTo(1));

var mudLists = DialogProvider.FindComponents<MudList>();
//Left sidebar (LoginDialog, PersonDialog)
//Left sidebar (LoginDialog)
Assert.That(mudLists, Has.Count.EqualTo(1));
var mudListItems = mudLists[0].FindComponents<MudListItem>();
Assert.That(mudListItems, Has.Count.EqualTo(2));
Assert.That(mudListItems, Has.Count.EqualTo(1));
}

[Test]
Expand All @@ -113,18 +112,17 @@ public async Task DialogCreated_LmsConnected_RenderLmsLoginDialogWithWorldsAndLo
await OpenDialogAndGetDialogReferenceAsync();

var mudTexts = DialogProvider.FindComponents<MudText>();
Assert.That(mudTexts, Has.Count.EqualTo(9));
Assert.That(mudTexts, Has.Count.EqualTo(8));
Assert.Multiple(() =>
{
Assert.That(mudTexts[0].Markup, Contains.Substring("DialogContent.Header"));
Assert.That(mudTexts[1].Markup, Contains.Substring(""));
Assert.That(mudTexts[2].Markup, Contains.Substring(""));
Assert.That(mudTexts[3].Markup, Contains.Substring("Header.Moodle.Text"));
Assert.That(mudTexts[4].Markup, Contains.Substring("DialogContent.Button.Logout"));
Assert.That(mudTexts[5].Markup, Contains.Substring("DialogContent.Delete.Subtitle"));
Assert.That(mudTexts[2].Markup, Contains.Substring("Header.Moodle.Text"));
Assert.That(mudTexts[3].Markup, Contains.Substring("DialogContent.Button.Logout"));
Assert.That(mudTexts[4].Markup, Contains.Substring("DialogContent.Delete.Subtitle"));
Assert.That(mudTexts[5].Markup, Contains.Substring("DialogContent.Delete.MoodleCourse"));
Assert.That(mudTexts[6].Markup, Contains.Substring("DialogContent.Delete.MoodleCourse"));
Assert.That(mudTexts[7].Markup, Contains.Substring("DialogContent.Delete.MoodleCourse"));
Assert.That(mudTexts[8].Markup, Contains.Substring("DialogContent.Delete.MoodleCourse"));
});

var mudTextFields = DialogProvider.FindComponents<MudTextField<string>>();
Expand Down Expand Up @@ -159,10 +157,10 @@ public async Task DialogCreated_IsLmsConnectedThrowsBackendApiUnreachableExcepti
await OpenDialogAndGetDialogReferenceAsync();

var mudTexts = DialogProvider.FindComponents<MudText>();
Assert.That(mudTexts, Has.Count.EqualTo(6));
Assert.That(mudTexts, Has.Count.EqualTo(5));
Assert.Multiple(() =>
{
Assert.That(mudTexts[4].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.APIUnreachable"));
Assert.That(mudTexts[3].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.APIUnreachable"));
});
}

Expand All @@ -183,10 +181,10 @@ public async Task DialogCreated_IsLmsConnectedThrowsBackendInvalidTokenException
await OpenDialogAndGetDialogReferenceAsync();

var mudTexts = DialogProvider.FindComponents<MudText>();
Assert.That(mudTexts, Has.Count.EqualTo(6));
Assert.That(mudTexts, Has.Count.EqualTo(5));
Assert.Multiple(() =>
{
Assert.That(mudTexts[4].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.TokenInvalid"));
Assert.That(mudTexts[3].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.TokenInvalid"));
});

await _presentationLogic.Received(2).IsLmsConnected();
Expand Down Expand Up @@ -299,7 +297,7 @@ public async Task EnterDetailsAndClickLoginButton_UrlDoesNotIncludeProtocol_Show

await _presentationLogic.Received(0).Login(Arg.Any<string>(), Arg.Any<string>());
var mudText = DialogProvider.FindComponents<MudText>();
Assert.That(mudText[4].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.ProtocolMissing"));
Assert.That(mudText[3].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.ProtocolMissing"));
}

[Test]
Expand All @@ -322,7 +320,7 @@ public async Task
mudButtons[0].Find("button").Click();

var mudText = DialogProvider.FindComponents<MudText>();
Assert.That(mudText[4].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.WrongUserOrPassword"));
Assert.That(mudText[3].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.WrongUserOrPassword"));
}

[Test]
Expand All @@ -344,7 +342,7 @@ public async Task ClickLoginButton_PresentationThrowsBackendInvalidUrlException_
mudButtons[0].Find("button").Click();

var mudText = DialogProvider.FindComponents<MudText>();
Assert.That(mudText[4].Find("h6").InnerHtml, Is.EqualTo("nix gut"));
Assert.That(mudText[3].Find("h6").InnerHtml, Is.EqualTo("nix gut"));
}

[Test]
Expand All @@ -365,8 +363,8 @@ public async Task ClickLoginButton_PresentationThrowsBackendApiUnreachableExcept
var mudButtons = DialogProvider.FindComponentsOrFail<MudButton>().ToArray();
mudButtons[0].Find("button").Click();

var mudText = DialogProvider.FindComponents<MudText>();
Assert.That(mudText[4].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.APIUnreachable"));
var mudTexts = DialogProvider.FindComponents<MudText>();
Assert.That(mudTexts[3].Find("h6").InnerHtml, Is.EqualTo("DialogContent.Error.APIUnreachable"));
}

[Test]
Expand Down
15 changes: 5 additions & 10 deletions Presentation/Components/Dialogues/LmsLoginDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<MudListItem title="@Localizer["DialogContent.LeftSidebar.AdLerServer"]" Icon="@moodle" OnClick="() => ChangeActiveSide(SideToShow.LoginDialog)">
</MudListItem>
<MudDivider Style="border-color: rgb(179,179,179)"/>
<MudListItem IconColor="Color.Default" Disabled="true" Icon="@Icons.Material.Filled.Person" OnClick="() => ChangeActiveSide(SideToShow.PersonDialog)"></MudListItem>

</MudList>
</MudPaper>
Expand Down Expand Up @@ -202,10 +201,6 @@

break;

case SideToShow.PersonDialog:

break;

default:
throw new ArgumentOutOfRangeException();
}
Expand All @@ -217,8 +212,7 @@

private enum SideToShow
{
LoginDialog,
PersonDialog
LoginDialog
}

private SideToShow ActiveSide { get; set; }
Expand Down Expand Up @@ -253,14 +247,14 @@
{
get => Configuration[IApplicationConfiguration.BackendBaseUrl];
set => Configuration[IApplicationConfiguration.BackendBaseUrl] = value;
}
}

private string Username
{
get => Configuration[IApplicationConfiguration.BackendUsername];
set => Configuration[IApplicationConfiguration.BackendUsername] = value;
}


private string _password = "";
private string _errorInvalidUrlMessage = "";
Expand Down Expand Up @@ -336,6 +330,7 @@
_errorInvalidUrlMessage = Localizer["DialogContent.Error.ProtocolMissing"];
return;
}

try
{
StartSpinner();
Expand Down

0 comments on commit 8607fd4

Please sign in to comment.