-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(Dimmer): Fix "simple" usage, add disabled prop #795
Conversation
14f588e
to
673fd0d
Compare
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.
This is great, thanks much. Couple updates to tests then we can merge this guy.
@@ -29,13 +29,13 @@ describe('Dimmer', () => { | |||
}) | |||
|
|||
describe('active', () => { | |||
it('removes the `disabled` className when true', () => { | |||
it('adds the `transition visible` className when true', () => { |
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.
The common test can be configured to assert a className that is different than the prop name. Should be able to replace this describe block with:
common.propKeyOnlyToClassName(Dimmer, 'active', {
className: 'active transition visible',
})
useKeyOnly(active, 'active'), | ||
useKeyOnly(!active, 'disabled'), | ||
useKeyOnly(active, 'active transition visible'), | ||
useKeyOnly(disabled, 'disabled'), |
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.
How about adding a common test for this?
common.propKeyOnlyToClassName(Dimmer, 'disabled')
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.
Added 👍
673fd0d
to
2ae5ce1
Compare
Added those tests and removed the ones for "active" that were testing duplicate functionality already covered by the common tests. Should be g2g 👍 |
Current coverage is 100% (diff: 100%)@@ master #795 diff @@
====================================
Files 136 136
Lines 2198 2198
Methods 0 0
Messages 0 0
Branches 0 0
====================================
Hits 2198 2198
Misses 0 0
Partials 0 0
|
I realized that #782 breaks the "simple" example: http://react.semantic-ui.com/modules/dimmer#simple-dimmer. That should be enabled by virtue of having a parent with
ui dimmable dimmed
. See the SUI-core docs: http://semantic-ui.com/modules/dimmer.html#simple-dimmerDigging into it further, two things stuck out to me:
visible
class, regardless of whether it was active.active
controls the opacity,visible
sets thevisibility
.disabled
is a prop that overrides any active/visible state so we shouldn't be using it for that.This fixes both issues.
visible
is only added when the dimmer is active, which removes the need to forcedisabled
, which enables clicking on children and fixes the "simple" usage.disabled
as a prop which conforms more to our API. A user can set that to override any active/visible state.