-
Notifications
You must be signed in to change notification settings - Fork 139
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
[feature] disabled
attribute
#120
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
933ad99
Add disabled option integration test
80bef41
Document disabled property
440426d
Fix tests, implement, and add to dummy app
e04bc87
Attempt handling `isShown` with `disabled`
ccea478
Fix isShown support, maybe.
f197594
Update travis and test targets
215ae04
Bring back 1.13 test target and ignore beta
cda19ae
Fix comment and observer order
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Ember from 'ember'; | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import { assertHide, assertShow } from '../../helpers/sync/assert-visibility'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
const { run } = Ember; | ||
|
||
moduleForComponent('tooltip-on-element', 'Integration | Option | disabled', { | ||
integration: true | ||
}); | ||
|
||
test('It disables tooltip', function(assert) { | ||
|
||
assert.expect(6); | ||
|
||
this.set('disabled', true); | ||
this.render(hbs`{{tooltip-on-element disabled=disabled}}`); | ||
|
||
assertHide(assert, this); | ||
|
||
/* Check hover doesn't trigger tooltip if disabled */ | ||
run(() => { | ||
this.$().trigger('mouseover'); | ||
}); | ||
|
||
assertHide(assert, this); | ||
|
||
/* Check hover triggers tooltip when not disabled */ | ||
this.set('disabled', false); | ||
|
||
run(() => { | ||
this.$().trigger('mouseover'); | ||
}); | ||
|
||
assertShow(assert, this); | ||
|
||
}); | ||
|
||
test('It disables tooltip even if isShown', function(assert) { | ||
|
||
assert.expect(4); | ||
|
||
this.set('disabled', true); | ||
this.render(hbs`{{tooltip-on-element disabled=disabled isShown=true}}`); | ||
|
||
assertHide(assert, this); | ||
|
||
run(() => { | ||
this.set('disabled', false); | ||
}); | ||
|
||
assertShow(assert, this); | ||
|
||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I can't comment below this line so see lines....
111: what if
enableLazyRendering=false
anddisabled=true
?129: what if
enableLazyRendering=false
but_shouldRender=false
? The didInsertElement will still apply $parent event handling and could still render the tooltip, even if it's never shown (not clean)If these happen to be edge cases you missed can you add tests for them?
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.
should I just handle
disabled
once before all of these conditionals, andreturn false
?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.
And what about in 128, if i skip the parent event stuff, and then disabled gets set to false, would that be rerun anywhere else?
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.
I think if you add this it'll take care of _shouldRender
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.
You're right. If we people change isDisabled we would need to add the event listeners to the $parent. I think maybe we should make the $parent event handling a function that can be called on didInsertElement and by observing
isDisabled
.We'd need good tests to cover this. It's getting fairly complex