Skip to content

Commit f320bf9

Browse files
committed
WIP
1 parent 8859c97 commit f320bf9

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed
Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
#if !os(iOS) && !os(tvOS) && !os(visionOS)
22
import SwiftUI
33
import SwiftUIIntrospect
4-
import XCTest
4+
import Testing
55

66
@MainActor
7-
final class ToggleWithCheckboxStyleTests: XCTestCase {
7+
@Suite
8+
struct ToggleWithCheckboxStyleTests {
89
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
910
typealias PlatformToggleWithCheckboxStyle = NSButton
1011
#endif
1112

12-
func testToggleWithCheckboxStyle() throws {
13-
XCTAssertViewIntrospection(of: PlatformToggleWithCheckboxStyle.self) { spies in
14-
let spy0 = spies[0]
15-
let spy1 = spies[1]
16-
let spy2 = spies[2]
17-
13+
@Test func testToggleWithCheckboxStyle() async throws {
14+
let (entity1, entity2, entity3) = try await introspection(of: PlatformToggleWithCheckboxStyle.self) { spy1, spy2, spy3 in
1815
VStack {
1916
Toggle("", isOn: .constant(true))
2017
.toggleStyle(.checkbox)
2118
#if os(macOS)
22-
.introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy0)
19+
.introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1)
2320
#endif
2421

2522
Toggle("", isOn: .constant(false))
2623
.toggleStyle(.checkbox)
2724
#if os(macOS)
28-
.introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy1)
25+
.introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2)
2926
#endif
3027

3128
Toggle("", isOn: .constant(true))
3229
.toggleStyle(.checkbox)
3330
#if os(macOS)
34-
.introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy2)
31+
.introspect(.toggle(style: .checkbox), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15, .v26), customize: spy3)
3532
#endif
3633
}
37-
} extraAssertions: {
38-
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
39-
XCTAssertEqual($0[safe: 0]?.state, .on)
40-
XCTAssertEqual($0[safe: 1]?.state, .off)
41-
XCTAssertEqual($0[safe: 2]?.state, .on)
42-
#endif
4334
}
35+
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
36+
#expect(entity1.state == .on)
37+
#expect(entity2.state == .off)
38+
#expect(entity3.state == .on)
39+
#endif
4440
}
4541
}
4642
#endif

0 commit comments

Comments
 (0)