diff --git a/spec/atom/editor-spec.coffee b/spec/atom/editor-spec.coffee index 8c7bed58a..0adf9b533 100644 --- a/spec/atom/editor-spec.coffee +++ b/spec/atom/editor-spec.coffee @@ -142,17 +142,17 @@ describe "Editor", -> editor.aceEditor.onCommandKey event, 0, event.which expect(handler.handleKeyEvent).toHaveBeenCalled() - describe "if the atom key event handler returns false, indicating that it did not handle the event", -> + describe "if the atom key event handler returns true, indicating that it did not handle the event", -> beforeEach -> - returnValue = false + returnValue = true it "does not stop the propagation of the event, allowing Ace to handle it as normal", -> editor.aceEditor.onCommandKey event, 0, event.which expect(event.stopPropagation).not.toHaveBeenCalled() - describe "if the atom key event handler returns true, indicating that it handled the event", -> + describe "if the atom key event handler returns false, indicating that it handled the event", -> beforeEach -> - returnValue = true + returnValue = false it "stops propagation of the event, so Ace does not attempt to handle it", -> editor.aceEditor.onCommandKey event, 0, event.which diff --git a/spec/atom/global-keymap-spec.coffee b/spec/atom/global-keymap-spec.coffee index ecc083cb5..f608e0b85 100644 --- a/spec/atom/global-keymap-spec.coffee +++ b/spec/atom/global-keymap-spec.coffee @@ -30,9 +30,9 @@ describe "GlobalKeymap", -> fragment.on 'insertChar', insertCharHandler describe "when the event's target node matches a selector with a matching binding", -> - it "triggers the command event associated with that binding on the target node and returns true", -> + it "triggers the command event associated with that binding on the target node and returns false", -> result = keymap.handleKeyEvent(keypressEvent('x', target: fragment[0])) - expect(result).toBeTruthy() + expect(result).toBe(false) expect(deleteCharHandler).toHaveBeenCalled() expect(insertCharHandler).not.toHaveBeenCalled() @@ -44,14 +44,14 @@ describe "GlobalKeymap", -> expect(insertCharHandler).toHaveBeenCalled() describe "when no binding matches the event", -> - it "returns false", -> - expect(keymap.handleKeyEvent(keypressEvent('0', target: fragment[0]))).toBe(false) + it "returns true, so the event continues to propagate", -> + expect(keymap.handleKeyEvent(keypressEvent('0', target: fragment[0]))).toBeTruthy() describe "when the event's target node *descends* from a selector with a matching binding", -> - it "triggers the command event associated with that binding on the target node and returns true", -> + it "triggers the command event associated with that binding on the target node and returns false", -> target = fragment.find('.child-node')[0] result = keymap.handleKeyEvent(keypressEvent('x', target: target)) - expect(result).toBeTruthy() + expect(result).toBe(false) expect(deleteCharHandler).toHaveBeenCalled() expect(insertCharHandler).not.toHaveBeenCalled() diff --git a/src/atom/global-keymap.coffee b/src/atom/global-keymap.coffee index 1a7bbdc82..3f83dff04 100644 --- a/src/atom/global-keymap.coffee +++ b/src/atom/global-keymap.coffee @@ -20,9 +20,9 @@ class GlobalKeymap for bindingSet in candidateBindingSets if command = bindingSet.commandForEvent(event) $(event.target).trigger(command) - return true + return false currentNode = currentNode.parent() - false + true reset: -> @BindingSets = []