Skip to content

Commit b9313ea

Browse files
committed
WIP
1 parent 2ac0f85 commit b9313ea

File tree

1 file changed

+16
-38
lines changed

1 file changed

+16
-38
lines changed

Tests/Tests/ViewTypes/SearchFieldTests.swift

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
#if !os(macOS) && !targetEnvironment(macCatalyst)
22
import SwiftUI
33
import SwiftUIIntrospect
4-
import XCTest
4+
import Testing
55

6-
@available(iOS 15, tvOS 15, *)
76
@MainActor
8-
final class SearchFieldTests: XCTestCase {
7+
@Suite
8+
struct SearchFieldTests {
99
#if canImport(UIKit)
1010
typealias PlatformSearchField = UISearchBar
1111
#endif
1212

13-
func testSearchFieldInNavigationStack() throws {
14-
guard #available(iOS 15, tvOS 15, *) else {
15-
throw XCTSkip()
16-
}
17-
18-
XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in
19-
let spy = spies[0]
20-
13+
@available(iOS 15, tvOS 15, *)
14+
@Test func introspectInNavigationStack() async throws {
15+
try await introspection(of: PlatformSearchField.self) { spy in
2116
NavigationView {
2217
Text("Customized")
2318
.searchable(text: .constant(""))
@@ -29,14 +24,9 @@ final class SearchFieldTests: XCTestCase {
2924
}
3025
}
3126

32-
func testSearchFieldInNavigationStackAsAncestor() throws {
33-
guard #available(iOS 15, tvOS 15, *) else {
34-
throw XCTSkip()
35-
}
36-
37-
XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in
38-
let spy = spies[0]
39-
27+
@available(iOS 15, tvOS 15, *)
28+
@Test func introspectInNavigationStackAsAncestor() async throws {
29+
try await introspection(of: PlatformSearchField.self) { spy in
4030
NavigationView {
4131
Text("Customized")
4232
.searchable(text: .constant(""))
@@ -48,17 +38,10 @@ final class SearchFieldTests: XCTestCase {
4838
}
4939
}
5040

51-
func testSearchFieldInNavigationSplitView() throws {
52-
guard #available(iOS 15, tvOS 15, *) else {
53-
throw XCTSkip()
54-
}
55-
guard #unavailable(visionOS 26) else { // TODO: verify this
56-
throw XCTSkip()
57-
}
58-
59-
XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in
60-
let spy = spies[0]
61-
41+
@available(iOS 15, tvOS 15, *)
42+
@available(visionOS, introduced: 1, obsoleted: 26)
43+
@Test func introspectInNavigationSplitView() async throws {
44+
try await introspection(of: PlatformSearchField.self) { spy in
6245
NavigationView {
6346
Text("Customized")
6447
.searchable(text: .constant(""))
@@ -76,14 +59,9 @@ final class SearchFieldTests: XCTestCase {
7659
}
7760
}
7861

79-
func testSearchFieldInNavigationSplitViewAsAncestor() throws {
80-
guard #available(iOS 15, tvOS 15, *) else {
81-
throw XCTSkip()
82-
}
83-
84-
XCTAssertViewIntrospection(of: PlatformSearchField.self) { spies in
85-
let spy = spies[0]
86-
62+
@available(iOS 15, tvOS 15, *)
63+
@Test func introspectInNavigationSplitViewAsAncestor() async throws {
64+
try await introspection(of: PlatformSearchField.self) { spy in
8765
NavigationView {
8866
Text("Customized")
8967
.searchable(text: .constant(""))

0 commit comments

Comments
 (0)