Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for popover menus (for copy, paste etc) #64

Open
KaneCheshire opened this issue Dec 11, 2019 · 2 comments
Open

Add support for popover menus (for copy, paste etc) #64

KaneCheshire opened this issue Dec 11, 2019 · 2 comments

Comments

@KaneCheshire
Copy link
Contributor

struct PopoverMenu: Element {
	
	let id: String? = nil // There is only one menu shared across the app, and it has no ID.
	let index: Int = 0
	let type: XCUIElement.ElementType = .menu
	let parent: Element
	
	var numberOfItems: Int { return underlyingXCUIElement.descendants(matching: .menuItem).count }
	
	init(parent: Element = App.shared) {
		self.parent = parent
	}
	
	var copy: Item { return item(withID: "Copy") }
	
	func item(withID id: String) -> Item {
		return Item(id: id, parent: self)
	}
	
}

extension PopoverMenu {
	
	struct Item: Element, Tappable {
		
		let id: String?
		let type: XCUIElement.ElementType = .menuItem
		let parent: Element
		
		init(id: String, parent: PopoverMenu) {
			self.id = id
			self.parent = parent
		}
		
	}
	
}
@KaneCheshire
Copy link
Contributor Author

These are actually called EditMenus in the HIGs: https://developer.apple.com/design/human-interface-guidelines/ios/controls/edit-menus/

@KaneCheshire
Copy link
Contributor Author

Disregard that mention ^ as far as I can see that wasn't added so I'm not sure why I mentioned it here. Perhaps I meant to reference a different issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant