-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c830228
commit ec94824
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ripePaymentSheetTests/PaymentSheet/PaymentMethodTypeCollectionViewCellSnapshotTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// PaymentMethodTypeCollectionViewCellSnapshotTests.swift | ||
// StripePaymentSheetTests | ||
// | ||
// Created by Till Hellmund on 11/21/24. | ||
// | ||
|
||
import Foundation | ||
import StripeCoreTestUtils | ||
import UIKit | ||
|
||
@testable@_spi(STP) import StripePaymentSheet | ||
|
||
class PaymentMethodTypeCollectionViewCellSnapshotTests: STPSnapshotTestCase { | ||
|
||
func test_withPromoBadge() { | ||
let cell = PaymentMethodTypeCollectionView.PaymentTypeCell() | ||
cell.paymentMethodType = .instantDebits | ||
cell.promoBadgeText = "$5" | ||
verify(cell) | ||
} | ||
|
||
func verify( | ||
_ cell: UICollectionViewCell, | ||
identifier: String? = nil, | ||
file: StaticString = #filePath, | ||
line: UInt = #line | ||
) { | ||
let view = CellWrapperView( | ||
cell: cell, | ||
size: CGSize(width: 120, height: PaymentMethodTypeCollectionView.cellHeight) | ||
) | ||
STPSnapshotVerifyView(view, identifier: identifier, file: file, line: line) | ||
} | ||
} | ||
|
||
private class CellWrapperView: UIView { | ||
init(cell: UICollectionViewCell, size: CGSize) { | ||
super.init(frame: CGRect(origin: .zero, size: size)) | ||
cell.frame = self.bounds | ||
addSubview(cell) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.9 KB
...otTests/testPaymentMethodRowButton_newPaymentMethod_withPromo_unselected@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.91 KB
...sts.PaymentMethodTypeCollectionViewCellSnapshotTests/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.