mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
6e60922f71
Подготовительный пр Вынес тесты на ContainerBlockLayout в отдельный файл + подпричесал остальные тесты, что увидел.
36 lines
1.0 KiB
Swift
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)
|
|
}
|
|
}
|