@@ -31,6 +31,39 @@ import Quick
3131internal final class NavigationRowSpec : QuickSpec {
3232
3333 override func spec( ) {
34+
35+ #if os(iOS)
36+ describe ( " initialization " ) {
37+ let detailText = DetailText . subtitle ( " subtitle " )
38+ let icon = Icon . named ( " icon " )
39+
40+ var actionInvoked = false
41+ var accessoryButtonActionInvoked = false
42+
43+ let row = NavigationRow (
44+ text: " title " ,
45+ detailText: detailText,
46+ icon: icon,
47+ action: { _ in actionInvoked = true } ,
48+ accessoryButtonAction: { _ in accessoryButtonActionInvoked = true }
49+ )
50+
51+ it ( " should initialize with given parameters " ) {
52+ expect ( row. text) == " title "
53+ expect ( row. detailText) == detailText
54+ expect ( row. icon) == icon
55+ expect ( row. cellReuseIdentifier) == " UITableViewCell.subtitle "
56+
57+ row. action ? ( row)
58+ expect ( actionInvoked) == true
59+
60+ row. accessoryButtonAction ? ( row)
61+ expect ( accessoryButtonActionInvoked) == true
62+ }
63+ }
64+
65+ #elseif os(tvOS)
66+
3467 describe ( " initialization " ) {
3568 let detailText = DetailText . subtitle ( " subtitle " )
3669 let icon = Icon . named ( " icon " )
@@ -53,6 +86,8 @@ internal final class NavigationRowSpec: QuickSpec {
5386 }
5487 }
5588
89+ #endif
90+
5691 describe ( " cellReuseIdentifier " ) {
5792 let a = NavigationRow ( text: " " , detailText: . none)
5893 let b = NavigationRow ( text: " " , detailText: . subtitle( " " ) )
@@ -67,6 +102,36 @@ internal final class NavigationRowSpec: QuickSpec {
67102 }
68103 }
69104
105+ #if os(iOS)
106+
107+ describe ( " accessoryType " ) {
108+ let a = NavigationRow ( text: " " , detailText: . none)
109+ let b = NavigationRow ( text: " " , detailText: . none, action: { _ in } )
110+ let c = NavigationRow ( text: " " , detailText: . none, accessoryButtonAction: { _ in } )
111+ let d = NavigationRow ( text: " " , detailText: . none, action: { _ in } , accessoryButtonAction: { _ in } )
112+
113+ it ( " should return the corresponding accessory type " ) {
114+ expect ( a. accessoryType) == UITableViewCell . AccessoryType. none
115+ expect ( b. accessoryType) == UITableViewCell . AccessoryType. disclosureIndicator
116+ expect ( c. accessoryType) == UITableViewCell . AccessoryType. detailButton
117+ expect ( d. accessoryType) == UITableViewCell . AccessoryType. detailDisclosureButton
118+ }
119+ }
120+
121+ #elseif os(iOS)
122+
123+ describe ( " accessoryType " ) {
124+ let a = NavigationRow ( text: " " , detailText: . none)
125+ let b = NavigationRow ( text: " " , detailText: . none, action: { _ in } )
126+
127+ it ( " should return the the corresponding accessory type " ) {
128+ expect ( a. accessoryType) == UITableViewCell . AccessoryType. none
129+ expect ( b. accessoryType) == UITableViewCell . AccessoryType. disclosureIndicator
130+ }
131+ }
132+
133+ #endif
134+
70135 describe ( " equatable " ) {
71136 let image = UIImage ( )
72137 let row = NavigationRow ( text: " Same " , detailText: . subtitle( " Same " ) , icon: . image( image) , action: nil )
0 commit comments