Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Apr 9, 2024
1 parent 3545520 commit 0fe1367
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/CommonAppleKit/CAListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Sources/CommonAppleKit/CAListViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<RootView: CAView>: CACollectionViewCell {
Expand Down
10 changes: 8 additions & 2 deletions Tests/CommonAppleKitTests/CommonAppleKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -128,12 +130,12 @@ final class CommonAppleKitTests: XCTestCase {
}

func testListView() {
let listView = CAListView<CellA, CellARootView, String>(frame: .init(x: 0, y: 0, width: 300, height: 500), itemSize: .init(width: 200, height: 100), cellId: "id", cellDelegate: self)
let listView = CAListView<CellA, FooterA, CellARootView, String>(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<CellA, CellARootView, Int>(frame: .zero, itemSize: .init(width: 200, height: 100))
let listView = CAScrollableListView<CellA, FooterA, CellARootView, Int>(frame: .zero, itemSize: .init(width: 200, height: 100))
listView.content = [1, 2]
}
}
Expand All @@ -146,6 +148,10 @@ extension CommonAppleKitTests: CAListViewCellDelegate {
func onAction(data: Any?) {

}

func onPageEndReached() {

}
}

extension CommonAppleKitTests: CACollectionViewDataSource {
Expand Down

0 comments on commit 0fe1367

Please sign in to comment.