From 1f1d20480ea6c62ca29cd105ab96bd0f454b6ca2 Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Wed, 13 Dec 2023 21:07:34 +0100 Subject: [PATCH] Fix tests --- Sources/CommonAppleKit/CAListViewCell.swift | 5 +++-- Tests/CommonAppleKitTests/CommonAppleKitTests.swift | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Sources/CommonAppleKit/CAListViewCell.swift b/Sources/CommonAppleKit/CAListViewCell.swift index 05020ce..4143d4e 100644 --- a/Sources/CommonAppleKit/CAListViewCell.swift +++ b/Sources/CommonAppleKit/CAListViewCell.swift @@ -17,8 +17,9 @@ open class CAListViewCell: CACollectionViewCell { #if canImport(AppKit) open override func loadView() { - view = createRootView() - rootView = view + let rootView = createRootView() + view = rootView + self.rootView = rootView } #elseif canImport(UIKit) open var representedObject: Any? diff --git a/Tests/CommonAppleKitTests/CommonAppleKitTests.swift b/Tests/CommonAppleKitTests/CommonAppleKitTests.swift index e709aef..cdbe0c6 100644 --- a/Tests/CommonAppleKitTests/CommonAppleKitTests.swift +++ b/Tests/CommonAppleKitTests/CommonAppleKitTests.swift @@ -13,7 +13,9 @@ private final class ControllerA: CAViewController { } private final class ControllerB: CAViewController { } -private final class CellA: CAListViewCell { } +private final class CellA: CAListViewCell { } + +private final class CellARootView: CAView { } private final class ViewA: CAView { override init(frame: CARect) { @@ -82,12 +84,12 @@ final class CommonAppleKitTests: XCTestCase { } func testListView() { - let listView = CAListView(frame: .zero, itemSize: .init(width: 200, height: 100), cellId: "id") + let listView = CAListView(frame: .zero, itemSize: .init(width: 200, height: 100), cellId: "id") listView.content = [] } func testScrollableListView() { - let listView = CAScrollableListView(frame: .zero, itemSize: .init(width: 200, height: 100), cellId: "id") + let listView = CAScrollableListView(frame: .zero, itemSize: .init(width: 200, height: 100), cellId: "id") listView.content = [] } }