Render the live location timeline item (#5209)
* created the data for the timeline item # Conflicts: # ElementX/Sources/Other/Logging/Tracing.swift # ElementX/Sources/Services/Authentication/AuthenticationService.swift # ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift * Implemented the LLS timeline item * updated preview tests * pr and design suggestions * previewscrollview is debug only
This commit is contained in:
@@ -42,6 +42,25 @@ struct DateTests {
|
||||
#expect(theMillennium.formattedMinimal() == theMillennium.formatted(.dateTime.year().day().month()))
|
||||
}
|
||||
|
||||
@Test
|
||||
func expirationDateFormatting() throws {
|
||||
// Within 24 hours → show time only
|
||||
let in23Hours = try #require(calendar.date(byAdding: .hour, value: 23, to: .now))
|
||||
#expect(in23Hours.formattedExpiration() == in23Hours.formatted(date: .omitted, time: .shortened))
|
||||
|
||||
// Just over the 24h boundary → show day and month
|
||||
let in25Hours = try #require(calendar.date(byAdding: .hour, value: 25, to: .now))
|
||||
#expect(in25Hours.formattedExpiration() == in25Hours.formatted(.dateTime.day().month()))
|
||||
|
||||
// Several months away → show day and month
|
||||
let inSixMonths = try #require(calendar.date(byAdding: .month, value: 6, to: .now))
|
||||
#expect(inSixMonths.formattedExpiration() == inSixMonths.formatted(.dateTime.day().month()))
|
||||
|
||||
// More than a year away → show year only
|
||||
let inTwoYears = try #require(calendar.date(byAdding: .year, value: 2, to: .now))
|
||||
#expect(inTwoYears.formattedExpiration() == inTwoYears.formatted(.dateTime.year()))
|
||||
}
|
||||
|
||||
@Test
|
||||
func dateSeparatorFormatting() throws {
|
||||
let today = try #require(calendar.date(byAdding: DateComponents(hour: 9, minute: 30), to: startOfToday))
|
||||
|
||||
Reference in New Issue
Block a user