mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-04-23 11:27:56 +08:00
[ASCollectionView] Allow User to Submit Updates Before Initial Data Load (#2337)
* Add tests for how UICV/ASCV will throw if you update before the initial data load * Allow user to submit updates before initial data load to workaround UICollectionView bug * Add some info
This commit is contained in:
@@ -588,4 +588,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// See the same test in ASUICollectionViewTests for the reference behavior.
|
||||
- (void)testThatIssuingAnUpdateBeforeInitialReloadIsAcceptable
|
||||
{
|
||||
ASCollectionViewTestDelegate *del = [[ASCollectionViewTestDelegate alloc] initWithNumberOfSections:0 numberOfItemsInSection:0];
|
||||
ASCollectionView *cv = [[ASCollectionView alloc] initWithCollectionViewLayout:[UICollectionViewFlowLayout new]];
|
||||
cv.asyncDataSource = del;
|
||||
cv.asyncDelegate = del;
|
||||
|
||||
// Add a section to the data source
|
||||
del->_itemCounts.push_back(0);
|
||||
// Attempt to insert section into collection view. We ignore it to workaround
|
||||
// the bug demonstrated by
|
||||
// ASUICollectionViewTests.testThatIssuingAnUpdateBeforeInitialReloadIsUnacceptable
|
||||
XCTAssertNoThrow([cv insertSections:[NSIndexSet indexSetWithIndex:0]]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user