-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(Button): add advanced handling of disabled prop #1781
Conversation
it('adds className icon when true', () => { | ||
shallow(<Button icon />) | ||
.should.have.className('icon') | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test
|
||
if (labelElement) { | ||
const classes = cx('ui', baseClasses, 'button', className) | ||
if (!_.isNil(label)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you take attention to these conditions you can see, that in fact there are two conditions: when the Button
has a container and has not.
pointing: labelPosition === 'left' ? 'right' : 'left', | ||
} }) | ||
|
||
if (labelElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this condition doesn't makes sence, we should use there check for the label
prop.
|
||
return ( | ||
<ElementType {...rest} className={containerClasses} onClick={this.handleClick}> | ||
{labelPosition === 'left' && labelElement} | ||
<button className={classes} ref={this.handleRef} tabIndex={tabIndex}> | ||
<button className={buttonClasses} disabled={disabled} ref={this.handleRef} tabIndex={tabIndex}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTML's button
tag can have a disabled
attr.
Codecov Report
@@ Coverage Diff @@
## master #1781 +/- ##
==========================================
- Coverage 99.75% 99.75% -0.01%
==========================================
Files 142 142
Lines 2459 2452 -7
==========================================
- Hits 2453 2446 -7
Misses 6 6
Continue to review full report at Codecov.
|
Perfect, thank you. |
Released in |
This PR:
render()
method