Skip to content

Commit 6d5b000

Browse files
committed
Update tests for row.cellStyle
1 parent 8075609 commit 6d5b000

6 files changed

Lines changed: 23 additions & 11 deletions

File tree

.github/workflows/run_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33

44
jobs:
55
run-tests:
6-
name: Build and test
6+
name: Run tests
77
runs-on: macOS-latest
88
steps:
99
- uses: actions/checkout@master
@@ -28,14 +28,14 @@ jobs:
2828
- name: Pod install
2929
run: |
3030
bundle exec pod install
31-
- name: Run unit tests
32-
run: |
31+
- run: |
3332
bundle exec fastlane ios unit_tests
33+
- run: |
3434
bundle exec fastlane tvos unit_tests
3535
- name: Report coverage
3636
run: |
3737
bash <(curl -s https://codecov.io/bash) -cF ios -J "QuickTableViewController"
38-
- name: Run UI tests
39-
run: |
38+
- run: |
4039
bundle exec fastlane ios ui_tests
40+
- run: |
4141
bundle exec fastlane tvos ui_tests

Source/Rows/NavigationRow.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ open class NavigationRow<T: UITableViewCell>: NavigationRowCompatible, Equatable
9999
return T.reuseIdentifier + (detailText?.style.stringValue ?? "")
100100
}
101101

102-
/// Returns the table view cell style for the specified subtitle.
102+
/// Returns the table view cell style for the specified detail text.
103103
public var cellStyle: UITableViewCell.CellStyle {
104104
return detailText?.style ?? .default
105105
}

Source/Rows/OptionRow.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ open class OptionRow<T: UITableViewCell>: OptionRowCompatible, Equatable {
8282
/// The reuse identifier of the table view cell to display the row. The default value is **UITableViewCell**.
8383
public let cellReuseIdentifier: String = T.reuseIdentifier
8484

85-
/// The cell style is `.default`.
86-
public let cellStyle: UITableViewCell.CellStyle = .default
85+
/// Returns the table view cell style for the specified detail text.
86+
public var cellStyle: UITableViewCell.CellStyle {
87+
return detailText?.style ?? .default
88+
}
8789

8890
/// The icon of the row.
8991
public let icon: Icon?

Source/Rows/SwitchRow.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ open class SwitchRow<T: SwitchCell>: SwitchRowCompatible, Equatable {
8484

8585
/// Returns the table view cell style for the specified detail text.
8686
public var cellStyle: UITableViewCell.CellStyle {
87-
return detailText?.style ?? .subtitle
87+
return detailText?.style ?? .default
8888
}
8989

9090
/// The icon of the row.

Tests/Row/OptionRowTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal final class OptionRowTests: XCTestCase {
4747

4848
// With RowStyle
4949
XCTAssertEqual(row.cellReuseIdentifier, "UITableViewCell")
50-
XCTAssertEqual(row.cellStyle, .default)
50+
XCTAssertEqual(row.cellStyle, .subtitle)
5151
XCTAssertEqual(row.icon, icon)
5252
XCTAssertEqual(row.accessoryType, .checkmark)
5353
XCTAssertEqual(row.isSelectable, true)

Tests/Row/SwitchRowTests.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,18 @@ internal final class SwitchRowTests: XCTestCase {
4646
XCTAssertEqual(row.switchValue, true)
4747

4848
// With RowStyle
49-
XCTAssertEqual(row.icon, icon)
5049
XCTAssertEqual(row.cellReuseIdentifier, "SwitchCell")
50+
XCTAssertEqual(row.cellStyle, .subtitle)
51+
XCTAssertEqual(row.icon, icon)
52+
XCTAssertNil(row.customize)
53+
54+
#if os(iOS)
55+
XCTAssertEqual(row.accessoryType, .none)
56+
XCTAssertEqual(row.isSelectable, false)
57+
#elseif os(tvOS)
58+
XCTAssertEqual(row.accessoryType, .checkmark)
59+
XCTAssertEqual(row.isSelectable, true)
60+
#endif
5161

5262
// When
5363
row.action?(row)

0 commit comments

Comments
 (0)