Skip to content

Commit

Permalink
[Chips] Remove visibleAreaInsets usage in examples with their corresp…
Browse files Browse the repository at this point in the history
…onding snapshot tests.

PiperOrigin-RevId: 320631647
  • Loading branch information
Wenyu Zhang authored and material-automation committed Jul 10, 2020
1 parent a76c191 commit c7dfe42
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions components/Chips/examples/ChipsTypicalUseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ @interface ChipsTypicalUseViewController
@property(nonatomic, strong) NSArray<ChipModel *> *model;
@property(nonatomic, strong) id<MDCContainerScheming> containerScheme;
@property(nonatomic) BOOL popRecognizerDelaysTouches;
@property(nonatomic) UIEdgeInsets chipVisibleAreaInsets;
@property(nonatomic) CGSize chipSize;
@property(nonatomic) BOOL chipCenterVisibleArea;
@end
Expand All @@ -54,8 +53,6 @@ @implementation ChipsTypicalUseViewController
- (instancetype)init {
MDCChipCollectionViewFlowLayout *layout = [[MDCChipCollectionViewFlowLayout alloc] init];
layout.minimumInteritemSpacing = 10;
MDCChipCollectionViewCell *cell = [[MDCChipCollectionViewCell alloc] init];
layout.estimatedItemSize = [cell intrinsicContentSize];

self = [super initWithCollectionViewLayout:layout];
if (self) {
Expand Down Expand Up @@ -160,11 +157,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView
cell.chipView.imageView.image = model.showProfilePic ? ChipsExampleAssets.faceImage : nil;
cell.chipView.selectedImageView.image = model.showDoneImage ? ChipsExampleAssets.doneImage : nil;
cell.chipView.accessoryView = model.showDeleteButton ? ChipsExampleAssets.deleteButton : nil;
if (!UIEdgeInsetsEqualToEdgeInsets(self.chipVisibleAreaInsets, UIEdgeInsetsZero)) {
cell.chipView.visibleAreaInsets = self.chipVisibleAreaInsets;
} else {
cell.chipView.hitAreaInsets = UIEdgeInsetsMake(-16, 0, -16, 0);
}
cell.chipView.centerVisibleArea = self.chipCenterVisibleArea;
cell.chipView.hitAreaInsets = UIEdgeInsetsMake(-16, 0, -16, 0);

[cell.chipView applyThemeWithScheme:self.containerScheme];
return cell;
Expand All @@ -189,9 +183,6 @@ - (CGSize)collectionView:(UICollectionView *)collectionView
chipView.selectedImageView.image = model.showDoneImage ? ChipsExampleAssets.doneImage : nil;
chipView.accessoryView = model.showDeleteButton ? ChipsExampleAssets.deleteButton : nil;
chipView.centerVisibleArea = self.chipCenterVisibleArea;
if (!UIEdgeInsetsEqualToEdgeInsets(self.chipVisibleAreaInsets, UIEdgeInsetsZero)) {
chipView.visibleAreaInsets = self.chipVisibleAreaInsets;
}
[chipView applyThemeWithScheme:self.containerScheme];
}
CGSize chipViewSize = [chipView intrinsicContentSize];
Expand Down Expand Up @@ -224,14 +215,6 @@ - (void)testDefaults {
[self.collectionView reloadData];
}

- (void)testVisibleAreaInsets {
// Given
self.chipVisibleAreaInsets = UIEdgeInsetsMake(8, 0, 8, 0);

// When
[self.collectionView reloadData];
}

- (void)testCustomSizeWhenCenterVisibleArea {
// Given
self.chipSize = CGSizeMake(44, 44);
Expand All @@ -241,8 +224,4 @@ - (void)testCustomSizeWhenCenterVisibleArea {
[self.collectionView reloadData];
}

- (void)setUp {
self.chipVisibleAreaInsets = UIEdgeInsetsZero;
}

@end

0 comments on commit c7dfe42

Please sign in to comment.