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 #75: md-button attaches class "md-undefined" to host element when on color provided #89

Closed
wants to merge 1 commit into from

Conversation

bakgat
Copy link

@bakgat bakgat commented Feb 19, 2016

No description provided.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 19, 2016
HostBinding,
HostListener,
ChangeDetectionStrategy,
Renderer,
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in the style conventions, you should not indent with a tab, better indent with two spaces.

Copy link
Author

Choose a reason for hiding this comment

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

done

@hansl
Copy link
Contributor

hansl commented Feb 24, 2016

Two things; you need a proper constructor in MdAnchor to fix the Dartanalyzer errors. And you should squash your commits so this PR includes only one commit. I'm going to review the code later when I have some time.

@bakgat
Copy link
Author

bakgat commented Feb 24, 2016

Thanks @hansl , still learning the first steps in contributing. Fixed the issues.

@@ -37,15 +55,15 @@ export class MdButton {
/** Whether a mousedown has occurred on this element in the last 100ms. */
isMouseDown: boolean = false;

setClassList() {return `md-${this.color}`;}
Copy link
Member

Choose a reason for hiding this comment

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

Why can this fix not be something like:

setClassList() {
  return color != null ? `md-${this.color}` : '';
}

?

Copy link
Author

Choose a reason for hiding this comment

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

  1. This results in an empty class attribute which is not valid XHTML
  2. It overrides any other specified class in the component

<button md-button class="myClass" color="warn">Submit</button>
results in
<button md-button class="md-warn">Submit</button>

It should be
<button md-button class="myClass md-warn">Submit</button>

Copy link
Member

Choose a reason for hiding this comment

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

I chatted with Misko and he agreed that this is an issue in Angular: angular/angular#7289

In the meantime I would be okay with the renderer approach.

@jelbourn
Copy link
Member

This change needs to add unit tests that cover the bug.

@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 Feb 27, 2016
@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@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 Feb 27, 2016
… when on color provided

fix(#75): fix md-button attaches class "md-undefined" to host element

fix(#75): correct indent

fix(#75): constructor in MdAnchor

fix(#75): fix incorrectly extending base class

fix(#75): fix Only static members can be accessed in initializers

fix(#75): still learning :/ fix 'this' cannot be referenced in current location

fix(#75): remove the previous color if one provided

fix(#75): fixed messing up the inputs

fix(#75): if value undefined, don't set element class

fix(#75): removed unused testComponent

fix(#75): replaced undefined with null because of dart
@bakgat
Copy link
Author

bakgat commented Feb 28, 2016

Two things:

  1. Why do the unit tests fail? There's a timeout for two tests. When I test locally, they succeed.
  2. I've changed the fix. When the color attribute change, the previous 'md-color_' is replaced by the new one.
    But: when a color is provided and later on it is removed (color=null) (ánd there are no other css-classes)
    the class attribute is left empty, which is invalid xhtml.
    This is a bug in angular.

devversion added a commit to devversion/material2 that referenced this pull request Mar 17, 2016
devversion added a commit to devversion/material2 that referenced this pull request Mar 18, 2016
devversion added a commit to devversion/material2 that referenced this pull request Mar 18, 2016
@jelbourn jelbourn closed this in 62265cc Mar 18, 2016
@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

5 participants