Skip to content

Commit ad25601

Browse files
committed
Add LabeledContentUITests
1 parent 5b54139 commit ad25601

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// LabeledContentUITests.swift
3+
// OpenSwiftUIUITests
4+
5+
import Testing
6+
import SnapshotTesting
7+
8+
@MainActor
9+
@Suite(.snapshots(record: .never, diffTool: diffTool))
10+
struct LabeledContentUITests {
11+
@Test
12+
func defaultStyle() {
13+
struct ContentView: View {
14+
var body: some View {
15+
LabeledContent {
16+
Color.red
17+
} label: {
18+
Color.blue
19+
}
20+
21+
}
22+
}
23+
openSwiftUIAssertSnapshot(of: ContentView())
24+
}
25+
26+
@Test
27+
func customStyle() {
28+
struct CustomStyle: LabeledContentStyle {
29+
func makeBody(configuration: Configuration) -> some View {
30+
VStack(spacing: 0) {
31+
configuration.label
32+
configuration.content
33+
}
34+
}
35+
}
36+
struct ContentView: View {
37+
var body: some View {
38+
LabeledContent {
39+
Color.red
40+
} label: {
41+
Color.blue
42+
}.labeledContentStyle(CustomStyle())
43+
}
44+
}
45+
openSwiftUIAssertSnapshot(of: ContentView())
46+
}
47+
}

0 commit comments

Comments
 (0)