Minor test update to validate that the new property doesn't cause the view to load.
Also removed some unused imports found during code review.
PiperOrigin-RevId: 484516340
The type of the message in Material Dialogs was switched from UILabel to UITextView, That is done in order to support links in attributed text. We're seeing some differences in the text rendering in dialog snapshots. In some cases, the width of the dialog may also change, which can result in some other elements moving to maintain required spacing from the edges. Based on our testing, we're not expecting any other changes, so please let us know if you find anything unusual.
This change set includes:
* `messageLabel` was renamed to `messageTextView`.
* The UITextView has its editable flag set to false, and all internal padding set to
zero, to ensure spacing remain the same as it was with UILabel.
* `scrollEnabled` was set to false to ensure text does't scroll when not needed (it
still enables scrolling when needed: when there's more text than the visible area.)
* `backgroundColor` was set to `clear`. It seems UITextView's default is white, which
breaks inverted/dark mode support.
Noticeable differences:
* `sizeThatFits` occasionally returns different width for some texts:
-- Some texts result in a wider layout (ie: dialogs-presented-with-emphasis-buttons.png)
-- Empty text views may have a non-zero height. Determining zero
size based on `hasText` before calling `sizeThatFits` resolved the issue.
* Text rendering is slightly different in almost all snapshots.
* Links in attributed texts are rendered differently then before (ie: color).
* In a couple of RTL snapshot tests, I needed to set the RTL test direction before
setting the message alignment for the test to work properly.
PiperOrigin-RevId: 313607718
Three MDCAlertController properties were not initialized during object initialization.
Their initialization during viewDidLoad caused values previously assigned to them to be reverted to default during presentation or theming.
Adding unit tests that reproduce the issue.
PiperOrigin-RevId: 308075191
Enables MDCAlertController and the title font to support automatic resizing of
fonts generated from a UIFontMetrics or UIFont preferredFont.
Part of #8672
This PR adds a shadowColor API to MDCAlertController and presentation controller. Snapshot test have been added for both MDCAlertController and the trackingView that the presentation controller uses since the MDCAlertController.view is a different view than the view that represents the shadow. This new API supports dynamic color.
Closes#7875
This changes adds test for legacy dynamic type, mainly focused on the behavior around adjustFontForContentSizeCategoryWhenScaledFontIsUnavailable and mdc_adjustFontForContentSizeCategory with respect to the buttonFont property.
Related to #7464
This change adds test within Dialogs around the behavior `adjustFontForContentSizeCategoryWhenScaledFontIsUnavailable` and `mdc_adjustFontForContentSizeCategory` specifically for the `messageFont`.
Related to #7464 & #7386
This changes adds test for _legacy_ dynamic type, mainly focused on the behavior around `adjustFontForContentSizeCategoryWhenScaledFontIsUnavailable` and `mdc_adjustFontForContentSizeCategory`. This additionally fixes a bug in Dialogs where it would set `mdc_adjustFontForContentSizeCategory` before other properties were set.
This only updates the behavior for `titleFont` within `MDCAlertController` in a follow up PR I will add test and the correct behavior for `messageFont` and `buttonFont`.
Related to #7464
## Motivation
In order to closely match UIKit behavior we need to have a flag for when a component wants to update some fonts for dynamic type but only those with scaling curves. Currently this is not possible to do because if dynamic type is on we automatically scale everything.
## Detailed changes
Add a runtime flag that can turn on scaling fonts no matter what or scales only if scalingCurves are attached to the font.
Related to #7386
Several unit tests were using identity comparison operations
(`XCTAssertEqual`) instead of equality comparison (`XCTAssertEqualObjects`).
Because UIFont supports `NSCopying`, assigning a UIFont to a `copy` property
can result in a copied object.
Unit tests seemed to flake sometimes, most recently in a Pull Request for
Dynamic Type (#6733).
QA=Unit tests pass
Our components should not implement or support property coding unless explicitly required. We generally removed support for this type of behavior early in 2018.
Many components were still implementing coding support.
Property coding has been removed from every component.
This change also removes `NS_DESIGNATED_INITIALIZER` from all initWithCoder APIs.
### Context
In working on #5296 I noticed a lot of the test had repeated code that can be pulled into a `setup` function. Additionally some of the test were missing _Given_, _When_, and _Then_ statements so those were added. This change hopefully makes this code more readable to future maintainers. I also noticed some of the test had extra work in the _Given_ that wasn't necessary so I removed that.
### The problem
Repeated steps in the _Given_ section of the test
### The fix
Implement the `setup` and `teardown` functions as well as add missing _Given_, _When_, and _Then_ comments.
### Related bugs
This isn't related to any bugs this is just something that I saw that could be improved.
Adding semantic emphasis to Dialog actions which allows conditional theming of buttons. The MDCDailogScheme now has a button scheme which can be used to theme buttons according to their action's assigned emphasis.
Issue: b/117608629
Design Review document (go/gmdc-ios-dialogs-design-doc).
Exposing a corner radius property on MDCAlertController.
Setting the Alert's corner radius updates its view's corner radius, as well as propagate the radius to the presentation controller so it can correctly render the tracking/shadow layer.
Issue: #4964
Issue: b/113257098
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.
This was an automated change generated by running a find-and-replace regular expression:
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at
http://www\.apache\.org/licenses/LICENSE-2\.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```
```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
To improve support for UI testing, `accessibilityIdentifier` values
should be attached to the action buttons of MDCAlertController views.
Instead of exposing the views and the buttons, an
`accessibilityIdentifier` property can be assigned to the MDCAlertAction
directly using the UIAccessibilityIdentification protocol.
Closes#4916
* Setting Properties on Alert controller will not force the view to load.
* Changed to the old approach on how to handle custom view and setting its properties.
* alertview check for alert title was missing.
* Unit tests Added.
https://github.com/material-components/material-components-ios/pull/4238
* Using the same approach as featureHighlight and making view internally a MDCAlertControllerView. this way we don't have to handle the situations where view is not loaded yet.
* adding a test to cover this case.
* Extracting Accessibility out of FeatureHighlightViewController to a mutator.
Tests added.
Example updated.
* Revert "Extracting Accessibility out of FeatureHighlightViewController to a mutator."
This reverts commit 0b5433ebf86366087b240c4dc4992a0603fa73e0.
* Expose typography API and Color API by exposing the MDCAlertControllerView.
Cleaning up the Dynamic Font size code.
* Setting mdc_adjustsFontForContentSizeCategory to false should reset fonts back to default.
* making the code more clear.
* exposing font and color properties for MDCAlertController.
* Fix the document update.
* loadViewIfNeeded is iOS 9+
* made buttonTitleColor Property name clear and fix the documentation.
* Revert "[Dialogs] Migrate to Material Motion. (#2481)"
This reverts commit 211ca772ea0456b56e522c0c67bd44312ddfe4d1.
* Bump animator back to 2.5.0
* Pull in develop project file
* Remove test for MMotion