File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,37 @@ extension AlgorithmTests {
140
140
141
141
XCTAssertEqual ( initial. apply ( differences) , final)
142
142
}
143
+
144
+ func testItemUpdatedAndMoved( ) {
145
+ let initial : [ s ] = [
146
+ s ( 1 , [
147
+ i ( 0 , " " ) ,
148
+ i ( 1 , " " ) ,
149
+ i ( 2 , " " ) ,
150
+ ] )
151
+ ]
152
+
153
+ let final : [ s ] = [
154
+ s ( 1 , [
155
+ i ( 1 , " u " ) ,
156
+ i ( 0 , " " ) ,
157
+ i ( 2 , " " ) ,
158
+ ] )
159
+ ]
160
+
161
+ let differences = try ! differencesForSectionedView ( initialSections: initial, finalSections: final)
162
+
163
+ XCTAssertTrue ( differences. count == 2 )
164
+
165
+ // updates ok
166
+ XCTAssertTrue ( differences [ 0 ] . onlyContains ( updatedItems: 1 ) )
167
+ XCTAssertTrue ( differences [ 0 ] . updatedItems [ 0 ] == ItemPath ( sectionIndex: 0 , itemIndex: 1 ) )
168
+
169
+ // moves ok
170
+ XCTAssertTrue ( differences [ 1 ] . onlyContains ( movedItems: 1 ) )
171
+
172
+ XCTAssertEqual ( initial. apply ( differences) , final)
173
+ }
143
174
}
144
175
145
176
// multiple sections simple
You can’t perform that action at this time.
0 commit comments