Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#1361_-_Add sort on edge models listing #1500

Merged
merged 2 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<MudTh></MudTh>
<MudTh><MudTableSortLabel SortLabel="Id" T="IoTEdgeListItem" id="sortDeviceId">Device ID</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="IsEnabled" T="IoTEdgeListItem">Allowed</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="Nb devices" T="IoTEdgeListItem">Nb devices</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortLabel="NbDevices" T="IoTEdgeListItem">Nb devices</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center">See details</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
</ToolBarContent>
<HeaderContent>
<MudTh></MudTh>
<MudTh>Name</MudTh>
<MudTh Style="text-align: center">Description</MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<IoTEdgeModelListItem, object>(x => x.Name)" id="NameLabel" >Name</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center"><MudTableSortLabel SortBy="new Func<IoTEdgeModelListItem, object>(x => x.Description)" id="DescriptionLabel">Description</MudTableSortLabel></MudTh>
<MudTh Style="text-align: center">Details</MudTh>
<MudTh Style="text-align: center">Delete</MudTh>
</HeaderContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,40 @@ public void ClickOnDeleteShouldDisplayConfirmationDialogAndReloadDeviceModelIfCo
cut.WaitForAssertion(() => this.mockEdgeModelServiceClient.Verify(service => service.GetIoTEdgeModelList(), Times.Exactly(2)));
cut.WaitForAssertion(() => MockRepository.VerifyAll());
}

[Test]
public void ClickOnSortLabel()
{
// Arrange
_ = this.mockEdgeModelServiceClient.Setup(x => x.GetIoTEdgeModelList())
.ReturnsAsync(new List<IoTEdgeModelListItem>()
{
new IoTEdgeModelListItem()
{
ModelId = Guid.NewGuid().ToString(),
Name = Guid.NewGuid().ToString()
},
new IoTEdgeModelListItem()
{
ModelId = Guid.NewGuid().ToString(),
Name = Guid.NewGuid().ToString()
},
});

// Act
var cut = RenderComponent<EdgeModelListPage>();

cut.WaitForAssertion(() => cut.WaitForElement("#NameLabel").Should().NotBeNull());
var sortNameButtons = cut.WaitForElement("#NameLabel");
sortNameButtons.Click();

cut.WaitForAssertion(() => cut.WaitForElement("#DescriptionLabel").Should().NotBeNull());
var sortDescriptionButtons = cut.WaitForElement("#DescriptionLabel");
sortDescriptionButtons.Click();

// Assert
cut.WaitForAssertion(() => Assert.AreEqual(3, cut.FindAll("tr").Count));
cut.WaitForAssertion(() => MockRepository.VerifyAll());
}
}
}