public void PointerPressed_On_Disabled_Item_Doesnt_Close_SubMenu() { var target = new DefaultMenuInteractionHandler(false); var menu = Mock.Of <IMenu>(); var parentItem = Mock.Of <IMenuItem>(x => x.IsTopLevel == true && x.HasSubMenu == true && x.IsSubMenuOpen == true && x.Parent == menu); var popup = new Popup(); var e = CreatePressed(popup); ((ISetLogicalParent)popup).SetParent(parentItem); target.PointerPressed(parentItem, e); Mock.Get(parentItem).Verify(x => x.Close(), Times.Never); Assert.True(e.Handled); }
public void PointerPressed_On_Item_With_SubMenu_Causes_Opens_Submenu() { var target = new DefaultMenuInteractionHandler(false); var menu = Mock.Of <IMenu>(); var parentItem = Mock.Of <IMenuItem>(x => x.IsTopLevel == true && x.HasSubMenu == true && x.Parent == menu); var item = Mock.Of <IMenuItem>(x => x.Parent == parentItem && x.HasSubMenu == true); var e = CreatePressed(item); target.PointerPressed(item, e); Mock.Get(item).Verify(x => x.Open()); Mock.Get(item).Verify(x => x.MoveSelection(NavigationDirection.First, true), Times.Never); Assert.True(e.Handled); }
public void Click_On_Open_TopLevel_Menu_Closes_Menu() { var target = new DefaultMenuInteractionHandler(false); var menu = Mock.Of <IMenu>(); var item = Mock.Of <IMenuItem>(x => x.IsSubMenuOpen == true && x.IsTopLevel == true && x.HasSubMenu == true && x.Parent == menu); var e = CreatePressed(item); target.PointerPressed(item, e); Mock.Get(menu).Verify(x => x.Close()); }
public void Click_On_Open_TopLevel_Menu_Closes_Menu() { var target = new DefaultMenuInteractionHandler(false); var menu = Mock.Of <IMenu>(); var item = Mock.Of <IMenuItem>(x => x.IsSubMenuOpen == true && x.IsTopLevel == true && x.HasSubMenu == true && x.Parent == menu); var e = new PointerPressedEventArgs { MouseButton = MouseButton.Left, Source = item }; target.PointerPressed(item, e); Mock.Get(menu).Verify(x => x.Close()); }
public void Click_On_TopLevel_Calls_MainMenu_Open() { var target = new DefaultMenuInteractionHandler(false); var menu = new Mock <IMainMenu>(); menu.As <IMenuElement>(); var item = Mock.Of <IMenuItem>(x => x.IsTopLevel == true && x.HasSubMenu == true && x.Parent == menu.Object); var e = CreatePressed(item); target.PointerPressed(item, e); menu.Verify(x => x.Open()); }