This repository was archived by the owner on Sep 5, 2024. It is now read-only.
fix(colors): handle null or undefined in md-colors#11673
Open
alirezamirian wants to merge 1 commit intoangular:masterfrom
Open
fix(colors): handle null or undefined in md-colors#11673alirezamirian wants to merge 1 commit intoangular:masterfrom
alirezamirian wants to merge 1 commit intoangular:masterfrom
Conversation
If md-colors expression evaluates to an object like `{ backgroundColor: undefined }`,
md-colors should handle it and remove backgroundColor css property.
Splaktar
suggested changes
Mar 13, 2019
Contributor
Splaktar
left a comment
There was a problem hiding this comment.
Thank you for your contribution. I had a few minor comments. Additionally, we'll want to add some tests to verify this functionality in https://github.com/angular/material/blob/fca9d1d52740765f522da1f47e269dd3a496974d/src/components/colors/colors.spec.js.
| * @returns rgba color string | ||
| */ | ||
| function parseColor(color, contrast) { | ||
| if(!color) { |
Contributor
There was a problem hiding this comment.
Please run npm run lint -- --fix to get these changes to pass the lint checks.
| @@ -121,6 +121,9 @@ | |||
| * @returns rgba color string | |||
Contributor
There was a problem hiding this comment.
This should be updated to be
* @returns {string} rgba color string or empty string| */ | ||
| function extractColorOptions(expression) { | ||
| if(!expression) { | ||
| return undefined; |
Contributor
There was a problem hiding this comment.
If this is going to start returning undefined, then we need to make sure that callers like interpolateColors() on lines 154 and 156 don't call parseColor(undefined).
Splaktar
added a commit
that referenced
this pull request
Mar 13, 2019
3 tasks
mmalerba
pushed a commit
that referenced
this pull request
Mar 14, 2019
<!-- Filling out this template is required! Do not delete it when submitting a Pull Request! Without this information, your Pull Request may be auto-closed. --> ## PR Checklist Please check that your PR fulfills the following requirements: - [x] The commit message follows [our guidelines](https://github.com/angular/material/blob/master/.github/CONTRIBUTING.md#-commit-message-format) - [x] Tests for the changes have been added or this is not a bug fix / enhancement - [x] Docs have been added, updated, or were not required ## PR Type What kind of change does this PR introduce? <!-- Please check the one that applies to this PR using "x". --> ``` [ ] Bugfix [ ] Enhancement [ ] Documentation content changes [ ] Code style update (formatting, local variables) [x] Refactoring (no functional changes, no api changes) [ ] Build related changes [ ] CI related changes [ ] Infrastructure changes [ ] Other... Please describe: ``` ## What is the current behavior? The Closure types / JSDoc in `md-colors` and `util/colors` is very inconsistent and/or missing. There are quite a few typos. <!-- Please describe the current behavior that you are modifying and link to one or more relevant issues. --> Issue Number: Relates to #11673 ## What is the new behavior? - Clean up typos. - The Closure types / JSDoc in `md-colors` and `util/colors` are much more helpful and organized. ## Does this PR introduce a breaking change? ``` [ ] Yes [x] No ``` <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. --> <!-- Note that breaking changes are highly unlikely to get merged to master unless the validation is clear and the use case is critical. --> ## Other information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Described in #11672
Issue Number:
Fixes #11672
What is the new behavior?
If the
md-colorsexpression evaluates to an object like{ backgroundColor: undefined },md-colorshandles it and removesbackgroundColorcss property.Does this PR introduce a breaking change?
Other information
Nothing