Fix tooltip command display when command has no keybinding

Esse commit está contido em:
Ben Ogle
2014-12-02 16:31:38 -08:00
commit 37e6f03346
2 arquivos alterados com 10 adições e 2 exclusões
+7
Ver Arquivo
@@ -59,6 +59,13 @@ describe "TooltipManager", ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement).toHaveText "⌃X ⌃Y"
it "does not display the keybinding if there is nothing mapped to the specified keyBindingCommand", ->
manager.add element, title: 'A Title', keyBindingCommand: 'test-command', keyBindingTarget: element
hover element, ->
tooltipElement = document.body.querySelector(".tooltip")
expect(tooltipElement.textContent).toBe "A Title"
describe "when .dispose() is called on the returned disposable", ->
it "no longer displays the tooltip on hover", ->
disposable = manager.add element, title: "Title"
+3 -2
Ver Arquivo
@@ -36,9 +36,10 @@ class TooltipManager
if keyBindingCommand?
bindings = atom.keymaps.findKeyBindings(command: keyBindingCommand, target: keyBindingTarget)
if options.title?
keystroke = getKeystroke(bindings)
if options.title? and keystroke?
options.title += " " + getKeystroke(bindings)
else
else if keystroke?
options.title = getKeystroke(bindings)
$target = $(target)