Toggle tests
This commit is contained in:
parent
7aa9f1369c
commit
8086ea0842
|
@ -70,6 +70,17 @@ private struct TextFieldTestView: View {
|
|||
}
|
||||
}
|
||||
|
||||
private struct ToggleTestView: View {
|
||||
let spy: () -> Void
|
||||
@State private var toggleValue = false
|
||||
var body: some View {
|
||||
Toggle("Toggle", isOn: $toggleValue)
|
||||
.introspectSwitch { uiSwitch in
|
||||
self.spy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class IntrospectTests: XCTestCase {
|
||||
func testNavigation() {
|
||||
|
||||
|
@ -114,4 +125,14 @@ class IntrospectTests: XCTestCase {
|
|||
TestUtils.present(view: view)
|
||||
wait(for: [expectation], timeout: 1)
|
||||
}
|
||||
|
||||
func testToggle() {
|
||||
|
||||
let expectation = XCTestExpectation()
|
||||
let view = ToggleTestView(spy: {
|
||||
expectation.fulfill()
|
||||
})
|
||||
TestUtils.present(view: view)
|
||||
wait(for: [expectation], timeout: 1)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue