From 0fe1367024c6e6e629d6e06d47b33118b705f6ff Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Tue, 9 Apr 2024 08:37:58 +0200 Subject: [PATCH] Fix tests --- Sources/CommonAppleKit/CAListView.swift | 2 +- Sources/CommonAppleKit/CAListViewCell.swift | 2 +- Tests/CommonAppleKitTests/CommonAppleKitTests.swift | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Sources/CommonAppleKit/CAListView.swift b/Sources/CommonAppleKit/CAListView.swift index 86cd48a..8e4168d 100644 --- a/Sources/CommonAppleKit/CAListView.swift +++ b/Sources/CommonAppleKit/CAListView.swift @@ -96,7 +96,7 @@ open class CAListView< } public func collectionView(_ collectionView: CACollectionView, willDisplaySupplementaryView view: CACollectionReusableView, forElementKind elementKind: String, at indexPath: IndexPath) { - cellDelegate?.pageEndReached() + cellDelegate?.onPageEndReached() } #if canImport(AppKit) diff --git a/Sources/CommonAppleKit/CAListViewCell.swift b/Sources/CommonAppleKit/CAListViewCell.swift index f329bfa..64caf72 100644 --- a/Sources/CommonAppleKit/CAListViewCell.swift +++ b/Sources/CommonAppleKit/CAListViewCell.swift @@ -11,7 +11,7 @@ import Foundation public protocol CAListViewCellDelegate: AnyObject { func onCellTap(data: Any?) func onAction(data: Any?) - func pageEndReached() + func onPageEndReached() } open class CAListViewCell: CACollectionViewCell { diff --git a/Tests/CommonAppleKitTests/CommonAppleKitTests.swift b/Tests/CommonAppleKitTests/CommonAppleKitTests.swift index 2f1ef6a..c434eb3 100644 --- a/Tests/CommonAppleKitTests/CommonAppleKitTests.swift +++ b/Tests/CommonAppleKitTests/CommonAppleKitTests.swift @@ -31,6 +31,8 @@ private final class CellARootView: CAView { fileprivate weak var cell: CellA? } +private final class FooterA: CACollectionReusableView { } + private final class ViewA: CAView { override init(frame: CARect) { super.init(frame: frame) @@ -128,12 +130,12 @@ final class CommonAppleKitTests: XCTestCase { } func testListView() { - let listView = CAListView(frame: .init(x: 0, y: 0, width: 300, height: 500), itemSize: .init(width: 200, height: 100), cellId: "id", cellDelegate: self) + let listView = CAListView(frame: .init(x: 0, y: 0, width: 300, height: 500), itemSize: .init(width: 200, height: 100), cellId: "id", cellDelegate: self) listView.content = ["one", "two"] } func testScrollableListView() { - let listView = CAScrollableListView(frame: .zero, itemSize: .init(width: 200, height: 100)) + let listView = CAScrollableListView(frame: .zero, itemSize: .init(width: 200, height: 100)) listView.content = [1, 2] } } @@ -146,6 +148,10 @@ extension CommonAppleKitTests: CAListViewCellDelegate { func onAction(data: Any?) { } + + func onPageEndReached() { + + } } extension CommonAppleKitTests: CACollectionViewDataSource {