mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
@@ -65,3 +65,19 @@ describe "SpacePen extensions", ->
|
||||
|
||||
it "replaces multiple keystroke", ->
|
||||
expect(humanizeKeystrokes('cmd-o ctrl-2')).toEqual '⌘O ⌃2'
|
||||
|
||||
describe "when the window is resized", ->
|
||||
it "hides the tooltips", ->
|
||||
class TooltipView extends View
|
||||
@content: ->
|
||||
@div()
|
||||
|
||||
view = new TooltipView()
|
||||
view.attachToDom()
|
||||
view.setTooltip('this is a tip')
|
||||
|
||||
view.tooltip('show')
|
||||
expect($(document.body).find('.tooltip')).toBeVisible()
|
||||
|
||||
$(window).trigger('resize')
|
||||
expect($(document.body).find('.tooltip')).not.toExist()
|
||||
|
||||
@@ -59,6 +59,13 @@ jQuery.fn.destroyTooltip = ->
|
||||
@hideTooltip()
|
||||
@tooltip('destroy')
|
||||
|
||||
# Hide tooltips when window is resized
|
||||
jQuery(document.body).on 'show.bs.tooltip', ({target}) ->
|
||||
windowHandler = -> jQuery(target).hideTooltip()
|
||||
jQuery(window).one('resize', windowHandler)
|
||||
jQuery(target).one 'hide.bs.tooltip', ->
|
||||
jQuery(window).off('resize', windowHandler)
|
||||
|
||||
jQuery.fn.setTooltip.getKeystroke = getKeystroke
|
||||
jQuery.fn.setTooltip.humanizeKeystrokes = humanizeKeystrokes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user