mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Merge pull request #16144 from atom/fix-jquery-handling-in-tooltip-manager-add-method
Fix handling of jQuery objects in `TooltipManager.add` method
This commit is contained in:
@@ -108,8 +108,12 @@ describe('TooltipManager', () => {
|
||||
const element2 = document.createElement('div')
|
||||
jasmine.attachToDOM(element2)
|
||||
|
||||
const fakeJqueryWrapper = [element, element2]
|
||||
fakeJqueryWrapper.jquery = 'any-version'
|
||||
const fakeJqueryWrapper = {
|
||||
0: element,
|
||||
1: element2,
|
||||
length: 2,
|
||||
jquery: 'any-version'
|
||||
}
|
||||
const disposable = manager.add(fakeJqueryWrapper, {title: 'Title'})
|
||||
|
||||
hover(element, () => expect(document.body.querySelector('.tooltip')).toHaveText('Title'))
|
||||
|
||||
@@ -114,7 +114,9 @@ class TooltipManager {
|
||||
add (target, options) {
|
||||
if (target.jquery) {
|
||||
const disposable = new CompositeDisposable()
|
||||
for (const element of target) { disposable.add(this.add(element, options)) }
|
||||
for (let i = 0; i < target.length; i++) {
|
||||
disposable.add(this.add(target[i], options))
|
||||
}
|
||||
return disposable
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user