Skip to content

Commit

Permalink
Fix table view infinite scrolling indicator removal
Browse files Browse the repository at this point in the history
  • Loading branch information
grigaci committed Dec 15, 2015
1 parent 62fd93b commit acf6b0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
3 changes: 3 additions & 0 deletions BIObjCHelpers/Views/TableView/BITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ - (void)setInfiniteScrollingState:(BIInfiniteScrollingState)infiniteScrollingSta
[self BI_createInfiniteScrollingActivityIndicatorContainer];
self.tableFooterView = self.infiniteScrollingActivityIndicatorContainer;
}
if (_infiniteScrollingState == BIInfiniteScrollingStateStopped) {
self.tableFooterView = nil;
}
}

- (void)setInfiniteScrollingEnabled:(BOOL)infiniteScrollingEnabled {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,23 @@ - (void)testFetchBatchCompletedWithSuccess {

#pragma mark - Test fetchBatchCompletedCommon

- (void)testFetchBatchCompletedCommonInsertTop {
BIBatchRequest *batchRequest = [[BIBatchRequest alloc] initWithCompletionBlock:nil];
batchRequest.insertPosition = BIBatchInsertPositionTop;
BIMutableBatchResponse *batchResponse = [[BIMutableBatchResponse alloc] initWithBatchRequest:batchRequest];
- (void)testFetchBatchCompletedCommonPullToRefresh {
BIMutableBatchRequest *mutableBatchRequest = [[BIMutableBatchRequest alloc] initWithCompletionBlock:nil];
mutableBatchRequest.options |= BIBatchRequestOptionPullToRefreshRequest;
BIMutableBatchResponse *mutableBatchResponse = [[BIMutableBatchResponse alloc] initWithBatchRequest:mutableBatchRequest];

[self.tableView triggerInfiniteScrolling];
[self.tableView triggerPullToRefresh];
[self.datasource handleFetchBatchResponseCommon:batchResponse];
XCTAssertEqual(self.tableView.infiniteScrollingState, BIInfiniteScrollingStateLoading);
[self.datasource handleFetchBatchResponseCommon:mutableBatchResponse];
XCTAssertFalse([self.tableView.pullToRefreshControl isRefreshing]);
XCTAssertNil(self.datasource.currentBatchRequest);
}

- (void)testFetchBatchCompletedCommonInsertBottom {
BIBatchRequest *batchRequest = [[BIBatchRequest alloc] initWithCompletionBlock:nil];
batchRequest.insertPosition = BIBatchInsertPositionBottom;
BIMutableBatchResponse *batchResponse = [[BIMutableBatchResponse alloc] initWithBatchRequest:batchRequest];
- (void)testFetchBatchCompletedCommonInfiniteScrolling {
BIMutableBatchRequest *mutableBatchRequest = [[BIMutableBatchRequest alloc] initWithCompletionBlock:nil];
mutableBatchRequest.options |= BIBatchRequestOptionInfiniteScrollingRequest;
BIMutableBatchResponse *mutableBatchResponse = [[BIMutableBatchResponse alloc] initWithBatchRequest:mutableBatchRequest];

[self.tableView triggerInfiniteScrolling];
[self.tableView triggerPullToRefresh];
[self.datasource handleFetchBatchResponseCommon:batchResponse];
[self.datasource handleFetchBatchResponseCommon:mutableBatchResponse];
XCTAssertEqual(self.tableView.infiniteScrollingState, BIInfiniteScrollingStateStopped);
XCTAssertTrue([self.tableView.pullToRefreshControl isRefreshing]);
XCTAssertNil(self.datasource.currentBatchRequest);
}

Expand Down

0 comments on commit acf6b0d

Please sign in to comment.