* 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>
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
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();
|
|
}
|
|
}
|