Skip to content

Commit

Permalink
Using non-dynamic colors
Browse files Browse the repository at this point in the history
  • Loading branch information
goergisn committed Jan 17, 2024
1 parent 8365e8b commit cf320d1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Tests/Card Tests/CardComponentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,12 @@ class CardComponentTests: XCTestCase {

var configuration = CardComponent.Configuration()

let tintColor: UIColor = .black
let titleColor: UIColor = .gray

configuration.style = {
var style = FormComponentStyle(tintColor: .systemYellow)
style.textField.title.color = .gray
var style = FormComponentStyle(tintColor: tintColor)
style.textField.title.color = titleColor
return style
}()

Expand All @@ -425,13 +428,14 @@ class CardComponentTests: XCTestCase {
let switchView: UISwitch = try XCTUnwrap(component.viewController.view.findView(with: "AdyenCard.CardComponent.storeDetailsItem.switch"))
let securityCodeItemView: FormTextItemView<FormCardSecurityCodeItem> = try XCTUnwrap(component.viewController.view.findView(with: "AdyenCard.CardComponent.securityCodeItem"))

XCTAssertEqual(securityCodeItemView.titleLabel.textColor, .gray)
wait(until: switchView, at: \.onTintColor, is: tintColor)

wait(until: securityCodeItemView, at: \.titleLabel.textColor, is: titleColor)

self.focus(textItemView: securityCodeItemView)
focus(textItemView: securityCodeItemView)

wait(until: switchView, at: \.onTintColor, is: .systemYellow)
wait(until: securityCodeItemView, at: \.titleLabel.textColor, is: .systemYellow)
wait(until: securityCodeItemView, at: \.separatorView.backgroundColor?.cgColor, is: UIColor.systemYellow.cgColor)
wait(until: securityCodeItemView, at: \.titleLabel.textColor, is: tintColor)
wait(until: securityCodeItemView, at: \.separatorView.backgroundColor, is: tintColor)
}

func testSuccessTintColorCustomization() throws {
Expand Down Expand Up @@ -2213,6 +2217,7 @@ class CardComponentTests: XCTestCase {

private func focus(textItemView: some FormTextItemView<some FormTextItem>) {
textItemView.textField.becomeFirstResponder()
wait(until: textItemView.textField, at: \.isFirstResponder, is: true)
}

private enum CardViewIdentifier {
Expand Down

0 comments on commit cf320d1

Please sign in to comment.