File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 <!-- View Controller-->
2929 <scene sceneID =" nO0-P2-PU1" >
3030 <objects >
31- <tableViewController id =" zAi-6L-laa" customClass =" ViewController" customModule =" Demo" customModuleProvider =" target" sceneMemberID =" viewController" >
31+ <tableViewController storyboardIdentifier = " ViewController " id =" zAi-6L-laa" customClass =" ViewController" customModule =" Demo" customModuleProvider =" target" sceneMemberID =" viewController" >
3232 <tableView key =" view" clipsSubviews =" YES" contentMode =" scaleToFill" alwaysBounceVertical =" YES" dataMode =" static" style =" grouped" separatorStyle =" default" rowHeight =" 44" sectionHeaderHeight =" 18" sectionFooterHeight =" 18" id =" SfK-mt-6Qw" >
3333 <rect key =" frame" x =" 0.0" y =" 0.0" width =" 375" height =" 667" />
3434 <autoresizingMask key =" autoresizingMask" widthSizable =" YES" heightSizable =" YES" />
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ class DemoTests: XCTestCase {
1010 let storyboard = UIStoryboard ( name: " Main " , bundle: Bundle . main)
1111 let id = String ( describing: ViewController . self)
1212
13- viewController = storyboard. instantiateViewController ( withIdentifier: id) as? ViewController
13+ viewController = storyboard. instantiateViewController ( withIdentifier: id) as! ViewController
14+ viewController. viewDidLoad ( )
1415 }
1516
1617 override func tearDown( ) {
@@ -30,11 +31,11 @@ class DemoTests: XCTestCase {
3031 XCTAssert ( number == 1 )
3132 }
3233
33- func testHideSection ( ) {
34- viewController. set ( cells: viewController. hideMeCell3, viewController. hideMeCell4, hidden: false )
34+ func testHideSectionRows ( ) {
35+ viewController. set ( cells: viewController. hideMeCell3, viewController. hideMeCell4, hidden: true )
3536 viewController. reloadData ( animated: true )
3637
37- let number = viewController. tableView. numberOfRows ( inSection: 1 )
38+ let number = viewController. tableView. numberOfRows ( inSection: 2 )
3839 XCTAssert ( number == 0 )
3940 }
4041
Original file line number Diff line number Diff line change @@ -96,17 +96,22 @@ class OriginalTable {
9696 deleteIndexPaths. removeAll ( )
9797 updateIndexPaths. removeAll ( )
9898
99- sections. flatMap { $0. rows } . forEach { ( row ) in
100- let indexPath = indexPathForInsertingOriginalRow ( row )
101-
99+ let allRows = sections. flatMap { $0. rows }
100+
101+ allRows . forEach { ( row ) in
102102 if row. batchOperation == . delete {
103+ let indexPath = indexPathForDeletingOriginalRow ( row)
103104 deleteIndexPaths. append ( indexPath)
104105 } else if row. batchOperation == . insert {
106+ let indexPath = indexPathForInsertingOriginalRow ( row)
105107 insertIndexPaths. append ( indexPath)
106108 } else if row. batchOperation == . update {
109+ let indexPath = indexPathForInsertingOriginalRow ( row)
107110 updateIndexPaths. append ( indexPath)
108111 }
109-
112+ }
113+
114+ allRows. forEach { ( row) in
110115 row. hiddenReal = row. hiddenPlanned
111116 row. batchOperation = BatchOperation . none
112117 }
You can’t perform that action at this time.
0 commit comments