Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yura Reutskiy committed Jan 2, 2025
1 parent 7aa5599 commit 6663f9b
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions Backpack-SwiftUI/Tests/Calendar/BPKCalendarTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class BPKCalendarTests: XCTestCase {
)
),
calendar: Calendar.current,
validRange: validStart...validEnd
validRange: validStart...validEnd,
calendarAccessibilityConfiguration: .mock
)
.frame(width: 320, height: 720)
)
Expand All @@ -63,7 +64,8 @@ class BPKCalendarTests: XCTestCase {
accessibilityConfigurations: rangeAccessibilityConfig
),
calendar: Calendar.current,
validRange: validStart...validEnd
validRange: validStart...validEnd,
calendarAccessibilityConfiguration: .mock
)
.frame(width: 320, height: 720)
)
Expand All @@ -80,7 +82,8 @@ class BPKCalendarTests: XCTestCase {
accessibilityConfigurations: rangeAccessibilityConfig
),
calendar: Calendar.current,
validRange: validStart...validEnd
validRange: validStart...validEnd,
calendarAccessibilityConfiguration: .mock
)
.frame(width: 320, height: 720)
)
Expand All @@ -98,6 +101,7 @@ class BPKCalendarTests: XCTestCase {
),
calendar: Calendar.current,
validRange: validStart...validEnd,
calendarAccessibilityConfiguration: .mock,
dayAccessoryView: { _ in
BPKIconView(.search, size: .small)
.foregroundColor(.accentColor)
Expand All @@ -118,7 +122,8 @@ class BPKCalendarTests: XCTestCase {
accessibilityConfigurations: rangeAccessibilityConfig
),
calendar: Calendar.current,
validRange: validStart...validEnd
validRange: validStart...validEnd,
calendarAccessibilityConfiguration: .mock
)
.frame(width: 320, height: 720)
)
Expand All @@ -141,3 +146,28 @@ class BPKCalendarTests: XCTestCase {
)
}
}

extension CalendarAccessibilityConfiguration {
static var mock: CalendarAccessibilityConfiguration {
return CalendarAccessibilityConfiguration(
singleSelection: .init(
accessibilityConfigurations: .init(
selectionHint: "hint"
),
dateFormatter: DateFormatter()
),
rangeSelection: .init(
accessibilityConfigurations: .init(
startSelectionHint: "startSelectionHint",
endSelectionHint: "endSelectionHint",
startSelectionState: "startSelectionState",
endSelectionState: "endSelectionState",
betweenSelectionState: "betweenSelectionState",
startAndEndSelectionState: "startAndEndSelectionState",
returnDatePrompt: "returnDatePrompt"
),
dateFormatter: DateFormatter()
)
)
}
}

0 comments on commit 6663f9b

Please sign in to comment.