Toggle tests

This commit is contained in:
Lois Di Qual 2019-11-27 10:31:57 -08:00
parent 7aa9f1369c
commit 8086ea0842
1 changed files with 21 additions and 0 deletions

View File

@ -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)
}
}