-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix binding SC deselection crash and publish 3.1.1 #921
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
#import <XCTest/XCTest.h> | ||
|
||
#import <OCMock/OCMock.h> | ||
#import <IGListKit/IGListKit.h> | ||
|
||
#import "IGTestDiffingDataSource.h" | ||
|
@@ -20,6 +21,7 @@ | |
#import "IGTestObject.h" | ||
#import "IGTestCell.h" | ||
#import "IGListTestCase.h" | ||
#import "IGTestBindingWithoutDeselectionDelegate.h" | ||
|
||
@interface IGListBindingSectionControllerTests : IGListTestCase | ||
|
||
|
@@ -121,6 +123,22 @@ - (void)test_whenDeselectingCell_thatCorrectViewModelSelected { | |
XCTAssertEqualObjects(section.deselectedViewModel, @"seven"); | ||
} | ||
|
||
- (void)test_whenDeselectingCell_withoutImplementation_thatNoOps { | ||
[self setupWithObjects:@[ | ||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]], | ||
]]; | ||
|
||
IGTestBindingWithoutDeselectionDelegate *delegate = [IGTestBindingWithoutDeselectionDelegate new]; | ||
IGTestDiffingSectionController *section = [self.adapter sectionControllerForObject:self.dataSource.objects.firstObject]; | ||
section.selectionDelegate = delegate; | ||
|
||
[self.adapter collectionView:self.collectionView didDeselectItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0]]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. W/out fix, tests crash here |
||
XCTAssertFalse(delegate.selected); | ||
|
||
[self.adapter collectionView:self.collectionView didSelectItemAtIndexPath:[NSIndexPath indexPathForItem:1 inSection:0]]; | ||
XCTAssertTrue(delegate.selected); | ||
} | ||
|
||
- (void)test_whenAdapterReloadsObjects_thatSectionUpdated { | ||
[self setupWithObjects:@[ | ||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) 2016-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import <IGListKit/IGListKit.h> | ||
|
||
@interface IGTestBindingWithoutDeselectionDelegate : NSObject <IGListBindingSectionControllerSelectionDelegate> | ||
|
||
@property (nonatomic, assign) BOOL selected; | ||
|
||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) 2016-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "IGTestBindingWithoutDeselectionDelegate.h" | ||
|
||
@implementation IGTestBindingWithoutDeselectionDelegate | ||
|
||
- (void)sectionController:(IGListBindingSectionController *)sectionController didSelectItemAtIndex:(NSInteger)index viewModel:(id)viewModel { | ||
self.selected = YES; | ||
} | ||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual fix here