File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ Changelog
3
3
4
4
## master
5
5
6
+ - Added ` .introspectTabView() ` on macOS
7
+
6
8
## [ 0.1.3]
7
9
8
10
- Added ` introspectTableViewCell `
Original file line number Diff line number Diff line change @@ -193,5 +193,10 @@ extension View {
193
193
public func introspectSegmentedControl( customize: @escaping ( NSSegmentedControl ) -> ( ) ) -> some View {
194
194
return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
195
195
}
196
+
197
+ /// Finds a `NSTabView` from a `SwiftUI.TabView`
198
+ public func introspectTabView( customize: @escaping ( NSTabView ) -> ( ) ) -> some View {
199
+ return introspect ( selector: TargetViewSelector . siblingContaining, customize: customize)
200
+ }
196
201
}
197
202
#endif
Original file line number Diff line number Diff line change @@ -183,6 +183,26 @@ private struct SegmentedControlTestView: View {
183
183
}
184
184
}
185
185
186
+ @available ( macOS 10 . 15 . 0 , * )
187
+ private struct TabViewTestView : View {
188
+ let spy : ( ) -> Void
189
+ var body : some View {
190
+ TabView {
191
+ Text ( " Contents " )
192
+ . tabItem {
193
+ Text ( " Tab 1 " )
194
+ }
195
+ Text ( " Contents " )
196
+ . tabItem {
197
+ Text ( " Tab 2 " )
198
+ }
199
+ }
200
+ . introspectTabView { tabView in
201
+ self . spy ( )
202
+ }
203
+ }
204
+ }
205
+
186
206
@available ( macOS 10 . 15 . 0 , * )
187
207
class AppKitTests : XCTestCase {
188
208
@@ -316,5 +336,15 @@ class AppKitTests: XCTestCase {
316
336
TestUtils . present ( view: view)
317
337
wait ( for: [ expectation] , timeout: TestUtils . Constants. timeout)
318
338
}
339
+
340
+ func testTabView( ) {
341
+
342
+ let expectation = XCTestExpectation ( )
343
+ let view = TabViewTestView ( spy: {
344
+ expectation. fulfill ( )
345
+ } )
346
+ TestUtils . present ( view: view)
347
+ wait ( for: [ expectation] , timeout: TestUtils . Constants. timeout)
348
+ }
319
349
}
320
350
#endif
You can’t perform that action at this time.
0 commit comments