Skip to content

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
yarneo committed Feb 25, 2021
2 parents 2c73e2d + bbfbff5 commit c3cec9d
Show file tree
Hide file tree
Showing 19 changed files with 192 additions and 88 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# 123.0.0

In this major release we have made the MDCBottomNavigationBarController class and its APIs only be available from iOS 12 and up.

## Breaking changes

The MDCBottomNavigationBarController class now only supports iOS 12 and up.

## Component changes

### ActivityIndicator

* [Add unit tests.](https://github.com/material-components/material-components-ios/commit/2416f191aa1b80b52bc4131d653e373ba83fd4dd) (Cody Weaver)

### BottomNavigation

* [Annotate APIs as only supporting iOS 12+.](https://github.com/material-components/material-components-ios/commit/b190b1c3344b209e48e0553a2832a3972c6bab71) (Jeff Verkoeyen)

### Dialogs

* [Adds dismissOnAction property to MDCAlertAction to allow callers to control when the dialog dismisses.](https://github.com/material-components/material-components-ios/commit/9c91e26f04cd5829cb996818a6d0119b23c944fa) (Nobody)

---

# 122.0.1

This patch release fixes a bug and generally cleans up import statements.
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponents.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load 'scripts/generated/icons.rb'

Pod::Spec.new do |mdc|
mdc.name = "MaterialComponents"
mdc.version = "122.0.1"
mdc.version = "123.0.0"
mdc.authors = "The Material Components authors."
mdc.summary = "A collection of stand-alone production-ready UI libraries focused on design details."
mdc.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsEarlGreyTests.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsEarlGreyTests"
s.version = "122.0.1"
s.version = "123.0.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components EarlGrey tests."
s.description = "This spec is made for use in the MDC Catalog."
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsExamples.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialComponentsExamples"
s.version = "122.0.1"
s.version = "123.0.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components examples."
s.description = "This spec is made for use in the MDC Catalog. Used in conjunction with CatalogByConvention we create our Material Catalog."
Expand Down
2 changes: 1 addition & 1 deletion MaterialComponentsSnapshotTests.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end

Pod::Spec.new do |s|
s.name = "MaterialComponentsSnapshotTests"
s.version = "122.0.1"
s.version = "123.0.0"
s.authors = "The Material Components authors."
s.summary = "This spec is an aggregate of all the Material Components snapshot tests."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122.0.1
123.0.0
4 changes: 2 additions & 2 deletions catalog/MDCCatalog/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>122.0.1</string>
<string>123.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>122.0.1</string>
<string>123.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIAppFonts</key>
Expand Down
4 changes: 2 additions & 2 deletions catalog/MDCDragons/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>122.0.1</string>
<string>123.0.0</string>
<key>CFBundleVersion</key>
<string>122.0.1</string>
<string>123.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
2 changes: 1 addition & 1 deletion catalog/MaterialCatalog/MaterialCatalog.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MaterialCatalog"
s.version = "122.0.1"
s.version = "123.0.0"
s.summary = "Helper Objective-C classes for the MDC catalog."
s.description = "This spec is made for use in the MDC Catalog."
s.homepage = "https://github.com/material-components/material-components-ios"
Expand Down
154 changes: 97 additions & 57 deletions components/ActivityIndicator/tests/unit/ActivityIndicatorTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,67 +26,66 @@ @interface MDCActivityIndicator (Private)
@end

@interface ActivityIndicatorTests : XCTestCase

@property(nonatomic, strong, nullable) MDCActivityIndicator *indicator;
@end

@implementation ActivityIndicatorTests

- (void)testSetRadiusMin {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];
- (void)setUp {
[super setUp];

self.indicator = [[MDCActivityIndicator alloc] init];
}

- (void)tearDown {
self.indicator = nil;

[super tearDown];
}

- (void)testSetRadiusMin {
// When
indicator.radius = 2;
self.indicator.radius = 2;

// Then
XCTAssertGreaterThanOrEqual(indicator.radius, 5);
XCTAssertGreaterThanOrEqual(self.indicator.radius, 5);
}

- (void)testSetRadius {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];

// When
CGFloat random = randomNumber();
indicator.radius = random;
self.indicator.radius = random;

// Then
XCTAssertGreaterThanOrEqual(indicator.radius, 8);
XCTAssertEqual(indicator.radius, random);
XCTAssertGreaterThanOrEqual(self.indicator.radius, 8);
XCTAssertEqual(self.indicator.radius, random);
}

- (void)testDefaultColorCycle {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];

// Then
XCTAssertGreaterThan(indicator.cycleColors.count, 0U,
XCTAssertGreaterThan(self.indicator.cycleColors.count, 0U,
@"The default value for |cycleColors| should be a non-empty array.");
}

- (void)testSetCycleColorsEmptyReturnsDefault {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];

// When
indicator.cycleColors = @[];
self.indicator.cycleColors = @[];

// Then
XCTAssertGreaterThan(indicator.cycleColors.count, 0U,
XCTAssertGreaterThan(self.indicator.cycleColors.count, 0U,
@"Assigning an empty array for |cycleColors| should result in a default"
" value being used instead.");
}

- (void)testSetCycleColorNonEmpty {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];
NSArray<UIColor *> *cycleColors = @[ [UIColor redColor], [UIColor whiteColor] ];

// When
indicator.cycleColors = cycleColors;
self.indicator.cycleColors = cycleColors;

// Then
XCTAssertEqualObjects(indicator.cycleColors, cycleColors,
XCTAssertEqualObjects(self.indicator.cycleColors, cycleColors,
@"With a non-empty array, the |cycleColors| property should override the"
" default value.");
}
Expand All @@ -95,72 +94,65 @@ - (void)testSetProgressValue {
// Make sure that setting progress with or without animation work regardless of whether indicator
// mode is determinate or indeterminate, and make sure that setting progress value doesn't change
// the mode.
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];

indicator.indicatorMode = MDCActivityIndicatorModeDeterminate;
[self verifySettingProgressOnIndicator:indicator animated:NO];
[self verifySettingProgressOnIndicator:indicator animated:YES];
XCTAssertEqual(indicator.indicatorMode, MDCActivityIndicatorModeDeterminate);

indicator.indicatorMode = MDCActivityIndicatorModeIndeterminate;
[self verifySettingProgressOnIndicator:indicator animated:NO];
[self verifySettingProgressOnIndicator:indicator animated:YES];
XCTAssertEqual(indicator.indicatorMode, MDCActivityIndicatorModeIndeterminate);
self.indicator.indicatorMode = MDCActivityIndicatorModeDeterminate;
[self verifySettingProgressOnIndicator:self.indicator animated:NO];
[self verifySettingProgressOnIndicator:self.indicator animated:YES];
XCTAssertEqual(self.indicator.indicatorMode, MDCActivityIndicatorModeDeterminate);

self.indicator.indicatorMode = MDCActivityIndicatorModeIndeterminate;
[self verifySettingProgressOnIndicator:self.indicator animated:NO];
[self verifySettingProgressOnIndicator:self.indicator animated:YES];
XCTAssertEqual(self.indicator.indicatorMode, MDCActivityIndicatorModeIndeterminate);
}

- (void)testSetProgressStrokeNonanimated {
// Make sure that the stroke layer updates accordingly when we set determinate progress.
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];
indicator.indicatorMode = MDCActivityIndicatorModeDeterminate;
self.indicator.indicatorMode = MDCActivityIndicatorModeDeterminate;

[indicator setProgress:(float)0.33 animated:NO];
XCTAssertEqual(indicator.strokeLayer.strokeStart, 0.0);
XCTAssertEqual(indicator.strokeLayer.strokeEnd, (float)0.33);
[self.indicator setProgress:(float)0.33 animated:NO];
XCTAssertEqual(self.indicator.strokeLayer.strokeStart, 0.0);
XCTAssertEqual(self.indicator.strokeLayer.strokeEnd, (float)0.33);
}

- (void)testSetProgressStrokeAnimated {
// Make sure that the stroke layer updates accordingly when we set determinate progress.
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];
indicator.indicatorMode = MDCActivityIndicatorModeDeterminate;
[indicator startAnimating];
self.indicator.indicatorMode = MDCActivityIndicatorModeDeterminate;
[self.indicator startAnimating];

[indicator setProgress:(float)0.55 animated:YES];
XCTAssertEqual(indicator.strokeLayer.strokeStart, 0.0);
XCTAssertEqual(indicator.strokeLayer.strokeEnd, (float)0.55);
[self.indicator setProgress:(float)0.55 animated:YES];
XCTAssertEqual(self.indicator.strokeLayer.strokeStart, 0.0);
XCTAssertEqual(self.indicator.strokeLayer.strokeEnd, (float)0.55);
}

- (void)testSetAccessibiltyLabelProperty {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];
NSString *testString = @"test this label";

// When
indicator.accessibilityLabel = testString;
self.indicator.accessibilityLabel = testString;

// Then
XCTAssertEqualObjects(indicator.accessibilityLabel, testString);
XCTAssertEqualObjects(self.indicator.accessibilityLabel, testString);
}

- (void)testStopsAnimatingWhenHidden {
// Given
MDCActivityIndicator *indicator = [[MDCActivityIndicator alloc] init];
[indicator startAnimating];
[self.indicator startAnimating];

// When
indicator.hidden = YES;
self.indicator.hidden = YES;

// Then
XCTAssertFalse(indicator.animating);
XCTAssertFalse(self.indicator.animating);
}

- (void)testTraitCollectionDidChangeBlockCalledWithExpectedParameters {
// Given
MDCActivityIndicator *activityIndicator = [[MDCActivityIndicator alloc] init];
XCTestExpectation *expectation =
[[XCTestExpectation alloc] initWithDescription:@"traitCollectionDidChange"];
__block UITraitCollection *passedTraitCollection;
__block MDCActivityIndicator *passedActivityIndicator;
activityIndicator.traitCollectionDidChangeBlock =
self.indicator.traitCollectionDidChangeBlock =
^(MDCActivityIndicator *_Nonnull indicator,
UITraitCollection *_Nullable previousTraitCollection) {
[expectation fulfill];
Expand All @@ -170,12 +162,60 @@ - (void)testTraitCollectionDidChangeBlockCalledWithExpectedParameters {
UITraitCollection *testTraitCollection = [UITraitCollection traitCollectionWithDisplayScale:7];

// When
[activityIndicator traitCollectionDidChange:testTraitCollection];
[self.indicator traitCollectionDidChange:testTraitCollection];

// Then
[self waitForExpectations:@[ expectation ] timeout:1];
XCTAssertEqual(passedTraitCollection, testTraitCollection);
XCTAssertEqual(passedActivityIndicator, activityIndicator);
XCTAssertEqual(passedActivityIndicator, self.indicator);
}

- (void)testTrackEnabledDefaultsToNo {
// Then
XCTAssertFalse(self.indicator.trackEnabled);
}

- (void)testTrackEnabledUpdatesWhenSet {
// When
self.indicator.trackEnabled = YES;

// Then
XCTAssertTrue(self.indicator.trackEnabled);
}

- (void)testDefaultStrokeWidth {
// Then
XCTAssertEqualWithAccuracy(self.indicator.strokeWidth, 2.5, 0.001);
}

- (void)testSetStrokeWidthToCustomValue {
// Given
CGFloat expectedWidth = 5;

// When
self.indicator.strokeWidth = expectedWidth;

// Then
XCTAssertEqualWithAccuracy(self.indicator.strokeWidth, expectedWidth, 0.001);
}

- (void)testDefaultAccessibilityTraits {
// Then
XCTAssertEqual(self.indicator.accessibilityTraits, UIAccessibilityTraitUpdatesFrequently);
}

- (void)testAccessibilityElementWhenAnimating {
// When
self.indicator.animating = YES;

// Then
XCTAssertTrue(self.indicator.isAccessibilityElement);
}

- (void)testDefaultIsAccessibilityElement {
// Then
XCTAssertFalse(self.indicator.animating);
XCTAssertFalse(self.indicator.isAccessibilityElement);
}

#pragma mark - Helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import MaterialComponents.MaterialBottomNavigation_BottomNavigationController
import MaterialComponents.MaterialBottomNavigation_Theming
import MaterialComponents.MaterialContainerScheme

@available(iOS 12.0, *)
class BottomNavigationHideShowExample: UIViewController {
static let cellReuseIdentifier = "cell"
static let numberOfCells = 40
Expand Down Expand Up @@ -73,6 +74,7 @@ class BottomNavigationHideShowExample: UIViewController {
}
}

@available(iOS 12.0, *)
extension BottomNavigationHideShowExample: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return BottomNavigationHideShowExample.numberOfCells
Expand All @@ -88,6 +90,7 @@ extension BottomNavigationHideShowExample: UITableViewDataSource {
}

// MARK: Catalog by convention
@available(iOS 12.0, *)
extension BottomNavigationHideShowExample {
@objc class func catalogMetadata() -> [String: Any] {
return [
Expand All @@ -96,9 +99,14 @@ extension BottomNavigationHideShowExample {
"presentable": false,
]
}

@objc class func minimumOSVersion() -> OperatingSystemVersion {
return OperatingSystemVersion(majorVersion: 12, minorVersion: 0, patchVersion: 0)
}
}

// MARK: Snapshot Testing by Convention
@available(iOS 12.0, *)
extension BottomNavigationHideShowExample {
@objc func testAdjustsContentInsetsForHiddenBottomBar() {
toggleBottomBar(animated: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
preserved. Upon decoding, if the view controllers array contains a reference to the previous
selected view controller, that view controller is set to selected.
*/
API_AVAILABLE(ios(12.0))
@interface MDCBottomNavigationBarController : UIViewController <MDCBottomNavigationBarDelegate>

/**
Expand Down
Loading

0 comments on commit c3cec9d

Please sign in to comment.