Skip to content

Commit

Permalink
Additional error check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Ginnivan committed Jul 29, 2013
1 parent bf9144a commit 83e9eec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/TestStack.White/UIItems/MenuItems/Menus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ namespace TestStack.White.UIItems.MenuItems
{
public class Menus : UIItemList<Menu>
{
private static readonly DictionaryMappedItemFactory Factory = new DictionaryMappedItemFactory();
static readonly DictionaryMappedItemFactory Factory = new DictionaryMappedItemFactory();

public Menus(AutomationElement parent, ActionListener actionListener)
{
if (parent == null) throw new ArgumentNullException("parent", "You must specify a parent automation id when creating a menu");
AutomationSearchCondition condition = AutomationSearchCondition.ByControlType(ControlType.MenuItem);
var finder = new AutomationElementFinder(parent);
finder = PerformanceHackAsPopupMenuForWin32AppComesOnDesktop(finder, parent);
Expand Down
8 changes: 3 additions & 5 deletions src/TestStack.White/UIItems/MenuItems/PopUpMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,26 @@ namespace TestStack.White.UIItems.MenuItems
{
public class PopUpMenu : UIItem
{
private readonly Menus topLevelMenus;
protected PopUpMenu() {}

public PopUpMenu(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
{
this.actionListener = actionListener;
topLevelMenus = new Menus(automationElement, actionListener);
}

public virtual Menus Items
{
get { return topLevelMenus; }
get { return new Menus(automationElement, actionListener); }
}

public virtual Menu Item(params string[] text)
{
return topLevelMenus.Find(text);
return Items.Find(text);
}

public virtual Menu ItemBy(params SearchCriteria[] path)
{
return topLevelMenus.Find(path);
return Items.Find(path);
}
}
}

0 comments on commit 83e9eec

Please sign in to comment.