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(checkbox, slide-toggle): only emit change event if native input emitted one. #820

Merged
merged 3 commits into from
Jul 15, 2016

Conversation

devversion
Copy link
Member

  • We should only emit a change event, when the native input element emitted one.


    This makes sure that the given component matches the native browser behavior and doesn't emit a change event for example, when changing the native checked property.

FYI: This change is also required for the radio component, but this should be addressed in another PR, since this will require a bit more work, through the radio group.

References #791

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 6, 2016
@devversion devversion force-pushed the fix/emit-native-change-event branch 3 times, most recently from b5c5424 to c79221c Compare July 6, 2016 18:59
@jelbourn
Copy link
Member

@devversion could you rebase?

@devversion devversion force-pushed the fix/emit-native-change-event branch from c79221c to a2141c4 Compare July 13, 2016 11:52
@devversion
Copy link
Member Author

@jelbourn Done!

@@ -214,13 +213,47 @@ describe('MdCheckbox', () => {
expect(testComponent.onCheckboxClick).toHaveBeenCalledTimes(1);
});

it('should emit a change event when the `checked` value changes', async(() => {
it('should trigger the change event properly', async(() => {
Copy link
Member

@jelbourn jelbourn Jul 14, 2016

Choose a reason for hiding this comment

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

"Property" isn't very specific. How about "should trigger a change event when the native input does" ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good

@jelbourn
Copy link
Member

LGTM besides the test name.

@robertmesserle I think this fix covers what you were doing in #739, any thoughts?

@robertmesserle
Copy link
Contributor

robertmesserle commented Jul 14, 2016

@jelbourn @devversion I think so. Does this fix the nested checkbox demo? I was using that as a test-case that I wanted to support.

#575 has a good demo for what I was trying to fix.

@devversion
Copy link
Member Author

@robertmesserle

Does this fix the nested checkbox demo?

Yeah, one minor thing needs to be fixed, because the (change) is now emitting a MdCheckboxChange class, instead of just the boolean.

#575 has a good demo for what I was trying to fix.

I tested that out, and it seems to work as well, when doing the adjustments for the MdCheckboxChange class.

@devversion devversion force-pushed the fix/emit-native-change-event branch from d847cf9 to ed51258 Compare July 14, 2016 18:59
@jelbourn
Copy link
Member

LGTM, just needs a rebase.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@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 Jul 15, 2016
@devversion devversion force-pushed the fix/emit-native-change-event branch from 482aff1 to d9f0025 Compare July 15, 2016 16:32
@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot removed the cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla label Jul 15, 2016
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 15, 2016
@devversion devversion force-pushed the fix/emit-native-change-event branch from d9f0025 to e5b461b Compare July 15, 2016 16:39
@devversion
Copy link
Member Author

@jelbourn Uff, I accidentally had the Slider PR from testing in there. but I was able to fix the branch, so it's now rebased again 😄

@jelbourn jelbourn added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Jul 15, 2016
@kara kara merged commit d52e6e0 into angular:master Jul 15, 2016
@devversion devversion deleted the fix/emit-native-change-event branch July 15, 2016 18:38
@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 6, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants