Add -[IGListAdapter sectionControllerForSection:]

Summary:
Before the diff, you can lookup the object for a given section, and then lookup the section controller for that object, but this seems like a pretty valuable/common operation.
Closes https://github.com/Instagram/IGListKit/pull/477

Differential Revision: D4537479

Pulled By: rnystrom

fbshipit-source-id: ad47a243f0bb0fc72a362863dff2f00b0b640fab
This commit is contained in:
Adlai Holler
2017-02-09 11:25:11 -08:00
committed by Facebook Github Bot
parent e05cf1e320
commit 106054c181
4 changed files with 36 additions and 10 deletions

View File

@@ -783,6 +783,15 @@ XCTAssertEqual(CGPointEqualToPoint(point, p), YES); \
XCTAssertEqual([self.adapter sectionForObject:@3], NSNotFound);
}
- (void)test_whenQueryingSectionControllerForSection_thatControllerReturned {
self.dataSource.objects = @[@0, @1, @2];
[self.adapter reloadDataWithCompletion:nil];
XCTAssertEqual([self.adapter sectionControllerForSection:0], [self.adapter sectionControllerForObject:@0]);
XCTAssertEqual([self.adapter sectionControllerForSection:1], [self.adapter sectionControllerForObject:@1]);
XCTAssertEqual([self.adapter sectionControllerForSection:2], [self.adapter sectionControllerForObject:@2]);
}
- (void)test_whenReloadingData_withNoDataSource_thatCompletionCalledWithNO {
self.dataSource.objects = @[@1];
IGListAdapter *adapter = [[IGListAdapter alloc] initWithUpdater:[IGListReloadDataUpdater new]