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

feat(Button): add advanced handling of disabled prop #1781

Merged
merged 1 commit into from
Jun 19, 2017

Conversation

layershifter
Copy link
Member

This PR:

it('adds className icon when true', () => {
shallow(<Button icon />)
.should.have.className('icon')
})
Copy link
Member Author

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)) {
Copy link
Member Author

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) {
Copy link
Member Author

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}>
Copy link
Member Author

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-io
Copy link

Codecov Report

Merging #1781 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/elements/Button/Button.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04ea612...e450045. Read the comment docs.

@levithomason levithomason merged commit d8cafb1 into master Jun 19, 2017
@levithomason
Copy link
Member

Perfect, thank you.

@levithomason levithomason deleted the fix/button-disabled branch June 19, 2017 15:50
@levithomason
Copy link
Member

Released in semantic-ui-react@0.69.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button: the disabled attribute doesn't apply to the button element
3 participants