-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIssueDetailPanelSnapshotTest.kt
More file actions
107 lines (100 loc) · 4.19 KB
/
Copy pathIssueDetailPanelSnapshotTest.kt
File metadata and controls
107 lines (100 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package com.composea11yscanner.ui
import androidx.compose.material3.MaterialTheme
import app.cash.paparazzi.DeviceConfig
import app.cash.paparazzi.Paparazzi
import com.composea11yscanner.core.model.A11ySeverity
import org.junit.Rule
import org.junit.Test
class IssueDetailPanelSnapshotTest {
@get:Rule
val paparazzi = Paparazzi(deviceConfig = DeviceConfig.PIXEL_5)
@Test
fun errorIssue_withWcagReference() {
paparazzi.snapshot {
MaterialTheme {
IssueDetailPanel(
issue = issueFixture(
severity = A11ySeverity.Error,
ruleName = "Missing Content Description",
message = "Interactive element has no content description. " +
"Screen readers cannot announce this.",
howToFix = "Add a meaningful contentDescription via semantics: " +
"Modifier.semantics { contentDescription = \"Describe action here\" }",
wcagReference = "WCAG 1.1.1 Non-text Content (Level A)",
),
onDismiss = {},
)
}
}
}
@Test
fun warningIssue_withWcagReference() {
paparazzi.snapshot {
MaterialTheme {
IssueDetailPanel(
issue = issueFixture(
severity = A11ySeverity.Warning,
ruleName = "Focus Order",
message = "Focus jumps upward from 200dp to 80dp.",
howToFix = "Reorder composables so focus flows top-to-bottom.",
wcagReference = "WCAG 2.4.3 Focus Order (Level A)",
),
onDismiss = {},
)
}
}
}
@Test
fun infoIssue_noWcagReference() {
paparazzi.snapshot {
MaterialTheme {
IssueDetailPanel(
issue = issueFixture(
severity = A11ySeverity.Info,
ruleName = "Text Scaling",
message = "Text does not scale with system font size.",
howToFix = "Use sp units for all text sizes.",
wcagReference = null,
),
onDismiss = {},
)
}
}
}
@Test
fun multipleIssues_showScrollableList() {
paparazzi.snapshot {
MaterialTheme {
IssueDetailPanel(
issues = listOf(
issueFixture(
severity = A11ySeverity.Error,
issueId = "clickable-role",
ruleName = "Clickable Role",
message = "Clickable element does not expose a button role.",
howToFix = "Apply Modifier.clickable(role = Role.Button) for action controls.",
wcagReference = "WCAG 4.1.2 Name, Role, Value (Level A)",
),
issueFixture(
severity = A11ySeverity.Warning,
issueId = "touch-target-overlap",
ruleName = "Touch Target Overlap",
message = "Effective touch target overlaps another target.",
howToFix = "Increase spacing so effective touch regions do not overlap.",
wcagReference = null,
),
issueFixture(
severity = A11ySeverity.Warning,
issueId = "missing-content-description",
ruleName = "Missing Content Description",
message = "Interactive element has no content description.",
howToFix = "Add a meaningful contentDescription via semantics.",
wcagReference = "WCAG 1.1.1 Non-text Content (Level A)",
),
),
onDismiss = {},
)
}
}
}
}