Remove overkill assertions

This commit is contained in:
Nathan Sobo 2013-04-10 16:57:37 -06:00 committed by Corey Johnson & Kevin Sawicki
parent bfbdfb46a8
commit 5e0dd80366
4 changed files with 16 additions and 6 deletions

View File

@ -5,9 +5,9 @@ describe "ConfigPanel", ->
class TestPanel extends ConfigPanel
@content: ->
@div =>
@input outlet: 'intInput', name: 'foo.int', type: 'int'
@input outlet: 'floatInput', name: 'foo.float', type: 'float'
@input outlet: 'stringInput', name: 'foo.string', type: 'string'
@input outlet: 'intInput', id: 'foo.int', type: 'int'
@input outlet: 'floatInput', id: 'foo.float', type: 'float'
@input outlet: 'stringInput', id: 'foo.string', type: 'string'
config.set('foo.int', 22)

View File

@ -165,6 +165,14 @@ describe "Keymap", ->
expect(deleteCharHandler).not.toHaveBeenCalled()
expect(insertCharHandler).not.toHaveBeenCalled()
describe "when the event matches a 'native!' binding", ->
it "returns true, allowing the browser's native key handling to process the event", ->
keymap.bindKeys '.grandchild-node', 'x': 'native!'
nativeHandler = jasmine.createSpy("nativeHandler")
fragment.on 'native!', nativeHandler
expect(keymap.handleKeyEvent(keydownEvent('x', target: fragment.find('.grandchild-node')[0]))).toBe true
expect(nativeHandler).not.toHaveBeenCalled()
describe "when at least one binding partially matches the event's keystroke", ->
[quitHandler, closeOtherWindowsHandler] = []

View File

@ -7,10 +7,10 @@ class ConfigPanel extends View
@bindFormFields()
bindFormFields: ->
for input in @find('input[name]').toArray()
for input in @find('input[id]').toArray()
do (input) =>
input = $(input)
name = input.attr('name')
name = input.attr('id')
type = input.attr('type')
@observeConfig name, (value) -> input.val(value) if value
input.on 'change', ->

View File

@ -113,7 +113,9 @@ class Keymap
candidateBindingSets = @bindingSetsForNode(currentNode, bindingSetsForFirstKeystroke)
for bindingSet in candidateBindingSets
command = bindingSet.commandForEvent(event)
if command
if command is 'native!'
return true
else if command
continue if @triggerCommandEvent(event, command)
return false
else if command == false