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

26 lines
972 B
Swift

import LayoutKit
import VGSL
import XCTest
final class SwitchableContainerBlockTests: XCTestCase {
func test_WhenUpdatesState_UsesIt() throws {
let state = SwitchableContainerBlockState(selectedItem: .right)
let states = [SwitchableContainerBlockTestModels.path: state]
let block = SwitchableContainerBlockTestModels.base
let updatedBlock = try block.updated(withStates: states)
XCTAssertEqual(updatedBlock.selectedItem, state.selectedItem)
XCTAssertNotEqual(updatedBlock.selectedItem, block.selectedItem)
}
func test_WhenUpdatesState_SendsStatesToItems() throws {
let state = GalleryViewState(contentOffset: 1, itemsCount: 2)
let states = [GalleryBlockTestModels.path: state]
let block = SwitchableContainerBlockTestModels.base
let updatedBlock = try block.updated(withStates: states)
let updatedGalleryBlock = updatedBlock.items.0.content as? GalleryBlock
XCTAssertEqual(updatedGalleryBlock?.state, state)
}
}