mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
35 lines
987 B
Swift
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
|
|
)
|