Test and document using introspectButton for Toggle on macOS (#92)
This commit is contained in:
parent
f30eea5234
commit
83d06a67af
|
@ -214,6 +214,18 @@ private struct ButtonTestView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(macOS 10.15.0, *)
|
||||||
|
private struct ToggleTestView: View {
|
||||||
|
let spy: () -> Void
|
||||||
|
@State private var toggleValue = false
|
||||||
|
var body: some View {
|
||||||
|
Toggle("Toggle", isOn: $toggleValue)
|
||||||
|
.introspectButton { button in
|
||||||
|
self.spy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 11.0, *)
|
||||||
private struct ColorWellTestView: View {
|
private struct ColorWellTestView: View {
|
||||||
@State private var color = Color.black
|
@State private var color = Color.black
|
||||||
|
@ -381,6 +393,16 @@ class AppKitTests: XCTestCase {
|
||||||
wait(for: [expectation], timeout: TestUtils.Constants.timeout)
|
wait(for: [expectation], timeout: TestUtils.Constants.timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testToggle() {
|
||||||
|
|
||||||
|
let expectation = XCTestExpectation()
|
||||||
|
let view = ToggleTestView(spy: {
|
||||||
|
expectation.fulfill()
|
||||||
|
})
|
||||||
|
TestUtils.present(view: view)
|
||||||
|
wait(for: [expectation], timeout: TestUtils.Constants.timeout)
|
||||||
|
}
|
||||||
|
|
||||||
func testColorPicker() {
|
func testColorPicker() {
|
||||||
|
|
||||||
if #available(macOS 11.0, *) {
|
if #available(macOS 11.0, *) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ List | UITableView | NSTableView | `.introspectTableView()`
|
||||||
View in List | UITableViewCell | NSTableCellView | `introspectTableViewCell()`
|
View in List | UITableViewCell | NSTableCellView | `introspectTableViewCell()`
|
||||||
TabView | UITabBarController | NSTabView | `.introspectTabBarController()` (iOS) <br/> `.introspectTabView()` (macOS)
|
TabView | UITabBarController | NSTabView | `.introspectTabBarController()` (iOS) <br/> `.introspectTabView()` (macOS)
|
||||||
TextField | UITextField | NSTextField | `.introspectTextField()`
|
TextField | UITextField | NSTextField | `.introspectTextField()`
|
||||||
Toggle | UISwitch | _N/A_ | `.introspectSwitch()`
|
Toggle | UISwitch | NSButton | `.introspectSwitch()` (iOS) <br/> `.introspectButton()` (macOS)
|
||||||
Slider | UISlider | NSSlider | `.introspectSlider()`
|
Slider | UISlider | NSSlider | `.introspectSlider()`
|
||||||
Stepper | UIStepper | NSStepper | `.introspectStepper()`
|
Stepper | UIStepper | NSStepper | `.introspectStepper()`
|
||||||
DatePicker | UIDatePicker | NSDatePicker | `.introspectDatePicker()`
|
DatePicker | UIDatePicker | NSDatePicker | `.introspectDatePicker()`
|
||||||
|
@ -197,4 +197,4 @@ $ bundle exec pod trunk push .
|
||||||
|
|
||||||
[Siteline_Badge]: https://badgen.net/badge/Built%20by/Siteline/blue?icon=https://uploads-ssl.webflow.com/5f4513afbbfc64c4777fcccf/5f525b122370d681879e170e_siteline-icon.svg
|
[Siteline_Badge]: https://badgen.net/badge/Built%20by/Siteline/blue?icon=https://uploads-ssl.webflow.com/5f4513afbbfc64c4777fcccf/5f525b122370d681879e170e_siteline-icon.svg
|
||||||
|
|
||||||
[Quintschaf_Badge]: https://badgen.net/badge/Maintained%20by/Quintschaf/cyan?icon=https://quintschaf.com/assets/logo.svg
|
[Quintschaf_Badge]: https://badgen.net/badge/Maintained%20by/Quintschaf/cyan?icon=https://quintschaf.com/assets/logo.svg
|
||||||
|
|
Loading…
Reference in New Issue