Skip to content
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(cdk-stepper): coercing selectedIndex value to a Number #14817

Merged

Conversation

s2-abdo
Copy link
Contributor

@s2-abdo s2-abdo commented Jan 14, 2019

Expected Behavior📗

The label of the stepper should show the current step index

Actual Behavior 📕

The number shown is wrong. It's adding a '1' for some reason

Description

Make a simple implementation of a Multi-Stepper and found out that the label information in the mobile view is not showing properly whenever 'selectedIndex' is used. It is handling the value as a string, therefore the result is 11/3 for example instead of 2/3.
'1' + 1 will be handled as a string concatenation.

Steps to Reproduce 🔬

Code
<mat-horizontal-stepper [linear]="true" selectedIndex="1"> <mat-step label="One"></mat-step> <mat-step label="Two"></mat-step> <mat-step label="Three"></mat-step> </mat-horizontal-stepper>

Proposed solution

Add a coercing to Number type for the selectedIndex value in its setter.

@s2-abdo s2-abdo requested a review from mmalerba as a code owner January 14, 2019 10:01
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 14, 2019
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, but can you add a unit test for it?

@ngbot
Copy link

ngbot bot commented Jan 16, 2019

Hi @s2-abdo! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added pr: lgtm target: patch This PR is targeted for the next patch release labels Jan 17, 2019
@crisbeto
Copy link
Member

@s2-abdo the CI failures will be fixed by #14854.

@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Jan 17, 2019
@ngbot
Copy link

ngbot bot commented Jan 17, 2019

I see that you just added the pr: merge ready label, but the following checks are still failing:
    failure status "ci/circleci: api_golden_checks" is failing
    failure status "ci/circleci: bazel_build_test" is failing
    failure status "ci/circleci: tests_local_browsers" is failing
    failure status "branch-manager" is failing
    failure status "ci/circleci: tests_browserstack" is failing
    failure status "ci/circleci: tests_saucelabs" is failing

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@s2-abdo s2-abdo force-pushed the fix-cdk-stepper-coerceNumberProperty branch from b60e751 to 0981b66 Compare January 18, 2019 11:40
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Jan 18, 2019
@mmalerba
Copy link
Contributor

@s2-abdo looks like that rebase wasn't quite right

@josephperrott josephperrott removed the action: merge The PR is ready for merge by the caretaker label Jan 22, 2019
@josephperrott
Copy link
Member

Removing merge ready label as the PR needs to be rebased back to master and then the cla can be checked again.

@mmalerba
Copy link
Contributor

@s2-abdo I attempted to fix this, I think it looks like how you had it: master...mmalerba:pr/14817 I can push to your PR branch if you like

@s2-abdo
Copy link
Contributor Author

s2-abdo commented Jan 23, 2019

@s2-abdo I attempted to fix this, I think it looks like how you had it: master...mmalerba:pr/14817 I can push to your PR branch if you like

@mmalerba sure, be free to do that. 👍

@mmalerba mmalerba force-pushed the fix-cdk-stepper-coerceNumberProperty branch from 322c6d6 to eb01fd6 Compare January 23, 2019 23:44
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Jan 23, 2019
@mmalerba mmalerba added the action: merge The PR is ready for merge by the caretaker label Jan 23, 2019
@mmalerba mmalerba force-pushed the fix-cdk-stepper-coerceNumberProperty branch from eb01fd6 to 0777887 Compare January 31, 2019 21:24
@mmalerba mmalerba merged commit e039d63 into angular:master Feb 1, 2019
mmalerba pushed a commit that referenced this pull request Feb 4, 2019
* fix(cdk-stepper): coercing selectedIndex value to a Number

* test(cdk-stepper): preselected value should be number
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants