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 datepicker #55

Closed
TABanniefung opened this issue Dec 5, 2019 · 2 comments · Fixed by #128
Closed

Add support for datepicker #55

TABanniefung opened this issue Dec 5, 2019 · 2 comments · Fixed by #128

Comments

@TABanniefung
Copy link

public struct DatePicker: Element {

public let id: String?
public let index: Int
public let parent: Element
public let type: XCUIElement.ElementType = .datePicker

/// Returns the number of wheels the picker contains.
public var numberOfWheels: Int { return underlyingXCUIElement.pickerWheels.count }

public init(id: String, index: Int = 0, parent: Element = App.shared) {
	self.id = id
	self.index = index
	self.parent = parent
}

public func wheel(_ index: Int) -> Wheel {
	return Wheel(index: index, picker: self)
}

}

public extension DatePicker {

struct Wheel: Element, ValueRepresentable, Adjustable {
	
	public let id: String? = nil
	public let index: Int
	public let parent: Element
	public let type: XCUIElement.ElementType = .pickerWheel
	public var value: String { return underlyingXCUIElement.value as? String ?? "" }
	
	public init(index: Int, picker: DatePicker) {
		self.index = index
		self.parent = picker
	}
	
	public func adjust(to newValue: String) {
		underlyingXCUIElement.adjust(toPickerWheelValue: newValue)
	}
	
}

}

@zacoid55
Copy link
Contributor

zacoid55 commented Dec 5, 2019

Is this something that could be raised as a PR, @TABanniefung?

@TABanniefung
Copy link
Author

@zacoid55 I have no permission 😰

@roger-tan roger-tan linked a pull request Aug 13, 2020 that will close this issue
5 tasks
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

Successfully merging a pull request may close this issue.

2 participants