[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:
Adlai Holler
2016-10-03 19:13:50 -04:00
committed by GitHub
parent 5205ef6840
commit 0a2e35af38
5 changed files with 57 additions and 6 deletions

View File

@@ -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