Files
divkit/client/ios/LayoutKit/LayoutKitTests/Blocks/GridBlockTests.swift
T
morevsavva 6e60922f71 Moved container tests
Подготовительный пр
Вынес тесты на ContainerBlockLayout в отдельный файл + подпричесал остальные тесты, что увидел.
2023-01-09 03:36:18 +03:00

36 lines
1.0 KiB
Swift

import XCTest
import CommonCore
import LayoutKit
final class GridBlockTests: XCTestCase {
func test_WhenUpdatesState_SendsStatesToChildren() throws {
let state = GalleryViewState(contentOffset: 1)
let states = [GalleryBlockTestModels.path: state]
let block = try! GridBlock(
widthTrait: .intrinsic,
heightTrait: .intrinsic,
contentAlignment: .default,
items: [.init(contents: GalleryBlockTestModels.base)],
columnCount: 1,
path: "/"
)
let updatedBlock = try block.updated(withStates: states)
let updatedGalleryBlock = updatedBlock.items.first?.contents as? GalleryBlock
XCTAssertEqual(updatedGalleryBlock?.state, state)
}
func test_IntrinsicHeightOfResizableGridIsZero() {
let block = try! GridBlock(
widthTrait: .resizable,
heightTrait: .resizable,
contentAlignment: .default,
items: [.init(contents: SeparatorBlock(direction: .vertical))],
columnCount: 1,
path: "/"
)
XCTAssertEqual(block.intrinsicContentHeight(forWidth: 100), 0)
}
}