Fixed background animation for actions

commit_hash:261bf87e49363c716993ae86a4eaf5449b546aa8
This commit is contained in:
pkurchatov
2024-11-26 18:38:48 +03:00
parent 11e87ff241
commit 27379544fb
2 changed files with 27 additions and 4 deletions
@@ -348,6 +348,29 @@ final class DivBaseExtensionsTests: XCTestCase {
assertEqual(block, expectedBlock)
}
func test_WithBackgroundAndActions() {
let action = divAction(logId: "action_log_id")
let block = makeBlock(
divSeparator(
actions: [action],
background: solidBackground(color("#112233"))
)
)
let expectedBlock = StateBlock(
child: DecoratingBlock(
child: separatorBlock(),
backgroundColor: color("#112233"),
actions: NonEmptyArray(action.uiAction(path: .root + "0")!),
actionAnimation: .default,
accessibilityElement: .default
),
ids: []
)
assertEqual(block, expectedBlock)
}
func test_WithLocalVariables() {
let block = makeBlock(
divText(
@@ -178,7 +178,7 @@ private final class DecoratingView: UIControl, BlockViewProtocol, VisibleBoundsT
return
}
updateContentHighlightState(animated: true)
updateHighlightState(animated: true)
}
}
@@ -188,7 +188,7 @@ private final class DecoratingView: UIControl, BlockViewProtocol, VisibleBoundsT
return
}
updateContentHighlightState(animated: false)
updateHighlightState(animated: false)
}
}
@@ -399,14 +399,14 @@ private final class DecoratingView: UIControl, BlockViewProtocol, VisibleBoundsT
setNeedsLayout()
}
private func updateContentHighlightState(animated: Bool) {
private func updateHighlightState(animated: Bool) {
updateContentBackgroundColor(animated: animated)
guard let actionAnimation = model.actionAnimation(for: highlightState) else {
return updateContentAlpha(animated: animated)
}
childView?.perform(actionAnimation, animated: animated)
perform(actionAnimation, animated: animated)
}
private func updateContentAlpha(animated: Bool) {