mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* Add select all controls to media lists * Refine select-all helper and add coverage * Adjust select-all button alignment * Tighten select-all helper semantics * Allow tests to access internal members * Rename select-all helper and avoid shift tracking * Simplify select-all reset helper * Keep pager centered and move select-all right * Add missing div * create test project for main app; move and rename new tests * remove core => main app reference * cleanup unused imports * Fix button behavior when the screen is small * update changelog --------- Co-authored-by: Jason Dove <1695733+jasongdove@users.noreply.github.com>pull/2742/merge
17 changed files with 174 additions and 19 deletions
@ -0,0 +1,23 @@ |
|||||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||||
|
|
||||||
|
<PropertyGroup> |
||||||
|
<TargetFramework>net10.0</TargetFramework> |
||||||
|
<ImplicitUsings>enable</ImplicitUsings> |
||||||
|
<Nullable>enable</Nullable> |
||||||
|
</PropertyGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\ErsatzTV\ErsatzTV.csproj" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
<ItemGroup> |
||||||
|
<PackageReference Include="NUnit" Version="4.4.0" /> |
||||||
|
<PackageReference Include="NUnit.Analyzers" Version="4.11.2"> |
||||||
|
<PrivateAssets>all</PrivateAssets> |
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
||||||
|
</PackageReference> |
||||||
|
<PackageReference Include="NUnit3TestAdapter" Version="6.0.1" /> |
||||||
|
<PackageReference Include="Shouldly" Version="4.3.0" /> |
||||||
|
</ItemGroup> |
||||||
|
|
||||||
|
</Project> |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
using ErsatzTV.Application.MediaCards; |
||||||
|
using ErsatzTV.Pages; |
||||||
|
using NUnit.Framework; |
||||||
|
using Shouldly; |
||||||
|
|
||||||
|
namespace ErsatzTV.Tests.Pages; |
||||||
|
|
||||||
|
[TestFixture] |
||||||
|
public class MultiSelectBaseTests |
||||||
|
{ |
||||||
|
[Test] |
||||||
|
public void Should_replace_existing_selection_and_return_last_card() |
||||||
|
{ |
||||||
|
var existingCard = new MediaCardViewModel(1, "Existing", "Sub", "Existing", "", Core.Domain.MediaItemState.Normal, false); |
||||||
|
var selected = new HashSet<MediaCardViewModel> { existingCard }; |
||||||
|
|
||||||
|
var first = new MediaCardViewModel(2, "First", "Sub", "First", "", Core.Domain.MediaItemState.Normal, false); |
||||||
|
var second = new MediaCardViewModel(3, "Second", "Sub", "Second", "", Core.Domain.MediaItemState.Normal, false); |
||||||
|
|
||||||
|
MultiSelectBase<Search>.ResetSelectionWithCards(selected, [first, second]); |
||||||
|
|
||||||
|
selected.ShouldBe([first, second], ignoreOrder: true); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void Should_clear_selection_when_no_cards() |
||||||
|
{ |
||||||
|
var existingCard = new MediaCardViewModel(1, "Existing", "Sub", "Existing", "", Core.Domain.MediaItemState.Normal, false); |
||||||
|
var selected = new HashSet<MediaCardViewModel> { existingCard }; |
||||||
|
|
||||||
|
MultiSelectBase<Search>.ResetSelectionWithCards(selected, []); |
||||||
|
|
||||||
|
selected.ShouldBeEmpty(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,3 @@ |
|||||||
|
using System.Runtime.CompilerServices; |
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("ErsatzTV.Tests")] |
||||||
Loading…
Reference in new issue