Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

fix(slider): fixed incorrect update of model and min/max values in same digest cycle #10980

Merged
merged 1 commit into from
Apr 10, 2018

Conversation

sviams
Copy link
Contributor

@sviams sviams commented Nov 9, 2017

Implemented check for out of sync state between model and view value in Slider, which occurred when both model and either min and/or max values were updated within the same digest cycle. This is due to the $ngModelCtrl formatters kicking in and validating the view value before the Slider directive $observer on the min and max attributes could fire.

Fixes #9125

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@googlebot googlebot added the cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ label Nov 9, 2017
@sviams
Copy link
Contributor Author

sviams commented Nov 9, 2017

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ and removed cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ labels Nov 9, 2017
@angular angular deleted a comment from googlebot Dec 19, 2017
@angular angular deleted a comment from googlebot Dec 19, 2017
@Splaktar Splaktar added needs: review This PR is waiting on review from the team P4: minor Minor issues. May not be fixed without community contributions. type: bug labels Dec 19, 2017
@Splaktar Splaktar self-assigned this Dec 19, 2017
@Splaktar Splaktar self-requested a review December 19, 2017 16:58
@Splaktar Splaktar added this to the 1.1.6 milestone Dec 19, 2017
@Splaktar Splaktar modified the milestones: 1.1.6, 1.1.7 Jan 17, 2018
@Splaktar Splaktar modified the milestones: 1.1.7, 1.1.8 Feb 7, 2018
@Splaktar Splaktar modified the milestones: 1.1.8, 1.1.9 Mar 17, 2018
@Splaktar
Copy link
Contributor

Splaktar commented Apr 5, 2018

Thank you for your contribution! Please update your commit message to follow the commit message guidelines. This is important for your changes to properly show up in the changelog.

For the last line, Fixes #9125 should be sufficient.

Copy link
Contributor

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

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

Functionally, this looks very good. I just had some questions about the last describe block and saw a few missing semicolons. The only other thing was the commit message needing to be updated. When you make the changes, please make sure to squash your commits and then force push your changes to the same branch (sviams:master in this case).

var slider = null;

beforeEach(function() {
slider = setup('min="0" max="{{max}}" ng-model="model"')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add semicolon at the end.

var slider = null;

beforeEach(function() {
slider = setup('min="0" max="{{max}}" ng-model="model"')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add semicolon at the end.

var slider = null;

beforeEach(function() {
slider = setup('min="{{min}}" max="10" ng-model="model"')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add semicolon at the end.

var slider = null;

beforeEach(function() {
slider = setup('min="{{min}}" max="10" ng-model="model"')
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add semicolon at the end.

pageScope.$apply();
expect(slider.attr('aria-valuenow')).toEqual('6');
expect(slider.attr('aria-valuemin')).toEqual('5');
pageScope.model = 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be checking "when updating min and model value equal to previous min simultaneously" rather than "when updating min and model value above previous min simultaneously". Since the previous min was 5 and the new model value is 5. Am I reading this wrong? Was this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, this was not entirely clear so I updated both the title and expectations of the test to better match the intention.

@Splaktar Splaktar changed the title fix(slider): Fixed incorrect update of model and min/max values in same digest cycle (#9125) fix(slider): fixed incorrect update of model and min/max values in same digest cycle Apr 5, 2018
@Splaktar
Copy link
Contributor

Splaktar commented Apr 5, 2018

Oh and one more thing, sorry for taking so long to get to reviewing this PR.

@Splaktar Splaktar added in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs and removed needs: review This PR is waiting on review from the team labels Apr 5, 2018
…igest cycle

Fix out of sync state between model and view value that occurs in Slider when both model
and either min and/or max values are updated within the same digest cycle.
This is due to the $ngModelCtrl formatters kicking in and validating the view value before
the Slider directive $observer on the min and max attributes can fire.

Fixes angular#9125
Copy link
Contributor

@Splaktar Splaktar left a comment

Choose a reason for hiding this comment

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

LGTM

@Splaktar Splaktar added the pr: merge ready This PR is ready for a caretaker to review label Apr 5, 2018
@Splaktar Splaktar added pr: lgtm This PR has been approved by the reviewer and removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs labels Apr 5, 2018
@Splaktar
Copy link
Contributor

Splaktar commented Apr 5, 2018

Thanks for the quick turnaround! Sending to presubmit testing now.

@Splaktar Splaktar assigned jelbourn and unassigned Splaktar Apr 9, 2018
@jelbourn jelbourn assigned tinayuangao and unassigned jelbourn Apr 9, 2018
@tinayuangao tinayuangao merged commit 50a1616 into angular:master Apr 10, 2018
chmelevskij pushed a commit to chmelevskij/material that referenced this pull request Jun 19, 2018
…igest cycle (angular#10980)

Fix out of sync state between model and view value that occurs in Slider when both model
and either min and/or max values are updated within the same digest cycle.
This is due to the $ngModelCtrl formatters kicking in and validating the view value before
the Slider directive $observer on the min and max attributes can fire.

Fixes angular#9125
Splaktar pushed a commit that referenced this pull request Jul 31, 2018
…igest cycle (#10980)

Fix out of sync state between model and view value that occurs in Slider when both model
and either min and/or max values are updated within the same digest cycle.
This is due to the $ngModelCtrl formatters kicking in and validating the view value before
the Slider directive $observer on the min and max attributes can fire.

Fixes #9125
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ P4: minor Minor issues. May not be fixed without community contributions. pr: lgtm This PR has been approved by the reviewer pr: merge ready This PR is ready for a caretaker to review type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants