Files
divkit/client/ios/LayoutKit/LayoutKitTests/Blocks/WrapperBlockTests.swift
T
pkurchatov 27a3472171 Enabled blankLinesBetweenImports swiftformat rule
commit_hash:84ea24cbdf21ef89741080f38ec5e583172a2458
2024-12-20 12:41:02 +03:00

35 lines
987 B
Swift

import LayoutKit
import VGSL
import XCTest
final class WrapperBlockTests: XCTestCase {
func test_WhenUpdatesState_SendsStatesToChildren() throws {
let state = GalleryViewState(contentOffset: 1, itemsCount: 2)
let states = [GalleryBlockTestModels.path: state]
let block = wrapperBlock
let updatedBlock = try block.updated(withStates: states)
let updatedGalleryBlock = updatedBlock.child as? GalleryBlock
XCTAssertEqual(updatedGalleryBlock?.state, state)
}
func test_whenChildHasReuseId_hasSameReuseId() throws {
let reuseId = "testReuseId"
let childBlock = GalleryBlockTestModels.base.addingDecorations(
reuseId: reuseId
)
let wrapperBlock: WrapperBlock = BackgroundBlock(
background: .solidColor(.clear),
child: childBlock
)
XCTAssertEqual(wrapperBlock.reuseId, reuseId)
}
}
private let wrapperBlock: WrapperBlock = BackgroundBlock(
background: .solidColor(.clear),
child: GalleryBlockTestModels.base
)