fix(ui): templates root-menu Escape + double-menu guard + reorder disabled tests (#258)
- Root context menu now has tabindex/focus + Escape-key close (OnRootMenuKeyDown) mirroring the node menu - Opening root menu calls _tree.DismissNodeContextMenu(); opening node menu fires OnNodeContextMenuOpened → DismissRootContextMenu so only one menu is ever visible - Add FolderContextMenu_MoveUp_IsDisabled_OnFirstSibling and FolderContextMenu_MoveDown_IsDisabled_OnLastSibling bUnit tests
This commit is contained in:
@@ -280,6 +280,36 @@ public class TemplatesPageTests : BunitContext
|
||||
_repo.Received(2).GetAllTemplatesAsync(Arg.Any<CancellationToken>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FolderContextMenu_MoveUp_IsDisabled_OnFirstSibling()
|
||||
{
|
||||
// Alpha is the first sibling (SortOrder 0) — Move up must be disabled.
|
||||
SeedTwoRootSiblings();
|
||||
|
||||
var cut = Render<TemplatesPage>();
|
||||
|
||||
var menu = OpenFolderContextMenu(cut, "Alpha");
|
||||
var moveUpBtn = menu.QuerySelectorAll("button.dropdown-item")
|
||||
.First(b => b.TextContent.Trim() == "Move up");
|
||||
|
||||
Assert.True(moveUpBtn.HasAttribute("disabled"), "Move up should be disabled for the first sibling");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FolderContextMenu_MoveDown_IsDisabled_OnLastSibling()
|
||||
{
|
||||
// Beta is the last sibling (SortOrder 1) — Move down must be disabled.
|
||||
SeedTwoRootSiblings();
|
||||
|
||||
var cut = Render<TemplatesPage>();
|
||||
|
||||
var menu = OpenFolderContextMenu(cut, "Beta");
|
||||
var moveDownBtn = menu.QuerySelectorAll("button.dropdown-item")
|
||||
.First(b => b.TextContent.Trim() == "Move down");
|
||||
|
||||
Assert.True(moveDownBtn.HasAttribute("disabled"), "Move down should be disabled for the last sibling");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RootContextMenu_OffersNewFolderAndNewTemplate()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user