mirror of
https://codeberg.org/secana/Forji.git
synced 2026-06-16 05:13:55 -07:00
test(issues): add preview for notFound state and extend PaginationState debug init
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f39e9f682d
commit
c82dedf957
2 changed files with 17 additions and 3 deletions
|
|
@ -27,10 +27,11 @@ final class PaginationState<Item> {
|
||||||
self.pageSize = pageSize
|
self.pageSize = pageSize
|
||||||
}
|
}
|
||||||
|
|
||||||
init(items: [Item], hasMore: Bool = false, pageSize: Int = 20) {
|
init(items: [Item], hasMore: Bool = false, pageSize: Int = 20, notFound: Bool = false) {
|
||||||
self.items = items
|
self.items = items
|
||||||
self.hasMore = hasMore
|
self.hasMore = hasMore
|
||||||
self.pageSize = pageSize
|
self.pageSize = pageSize
|
||||||
|
self.notFound = notFound
|
||||||
}
|
}
|
||||||
|
|
||||||
@discardableResult
|
@discardableResult
|
||||||
|
|
|
||||||
|
|
@ -151,11 +151,12 @@ struct IssueListView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
init(preview _: Void, repository: Repository, authService: AuthenticationService, issues: [Issue]) {
|
init(preview _: Void, repository: Repository, authService: AuthenticationService, issues: [Issue],
|
||||||
|
notFound: Bool = false) {
|
||||||
self.repository = repository
|
self.repository = repository
|
||||||
self.authService = authService
|
self.authService = authService
|
||||||
issueService = nil
|
issueService = nil
|
||||||
_pagination = State(initialValue: PaginationState(items: issues))
|
_pagination = State(initialValue: PaginationState(items: issues, notFound: notFound))
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -171,6 +172,18 @@ struct IssueListView: View {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Preview("Issues Unavailable") {
|
||||||
|
NavigationStack {
|
||||||
|
IssueListView(
|
||||||
|
preview: (),
|
||||||
|
repository: .preview,
|
||||||
|
authService: .previewDefault,
|
||||||
|
issues: [],
|
||||||
|
notFound: true,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct IssueRow: View {
|
struct IssueRow: View {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue