mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
Fixed background animation for actions
commit_hash:261bf87e49363c716993ae86a4eaf5449b546aa8
This commit is contained in:
@@ -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(
|
||||
|
||||
+4
-4
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user