mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03:00
Remove overkill assertions
This commit is contained in:
parent
bfbdfb46a8
commit
5e0dd80366
@ -5,9 +5,9 @@ describe "ConfigPanel", ->
|
|||||||
class TestPanel extends ConfigPanel
|
class TestPanel extends ConfigPanel
|
||||||
@content: ->
|
@content: ->
|
||||||
@div =>
|
@div =>
|
||||||
@input outlet: 'intInput', name: 'foo.int', type: 'int'
|
@input outlet: 'intInput', id: 'foo.int', type: 'int'
|
||||||
@input outlet: 'floatInput', name: 'foo.float', type: 'float'
|
@input outlet: 'floatInput', id: 'foo.float', type: 'float'
|
||||||
@input outlet: 'stringInput', name: 'foo.string', type: 'string'
|
@input outlet: 'stringInput', id: 'foo.string', type: 'string'
|
||||||
|
|
||||||
config.set('foo.int', 22)
|
config.set('foo.int', 22)
|
||||||
|
|
||||||
|
@ -165,6 +165,14 @@ describe "Keymap", ->
|
|||||||
expect(deleteCharHandler).not.toHaveBeenCalled()
|
expect(deleteCharHandler).not.toHaveBeenCalled()
|
||||||
expect(insertCharHandler).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", ->
|
describe "when at least one binding partially matches the event's keystroke", ->
|
||||||
[quitHandler, closeOtherWindowsHandler] = []
|
[quitHandler, closeOtherWindowsHandler] = []
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ class ConfigPanel extends View
|
|||||||
@bindFormFields()
|
@bindFormFields()
|
||||||
|
|
||||||
bindFormFields: ->
|
bindFormFields: ->
|
||||||
for input in @find('input[name]').toArray()
|
for input in @find('input[id]').toArray()
|
||||||
do (input) =>
|
do (input) =>
|
||||||
input = $(input)
|
input = $(input)
|
||||||
name = input.attr('name')
|
name = input.attr('id')
|
||||||
type = input.attr('type')
|
type = input.attr('type')
|
||||||
@observeConfig name, (value) -> input.val(value) if value
|
@observeConfig name, (value) -> input.val(value) if value
|
||||||
input.on 'change', ->
|
input.on 'change', ->
|
||||||
|
@ -113,7 +113,9 @@ class Keymap
|
|||||||
candidateBindingSets = @bindingSetsForNode(currentNode, bindingSetsForFirstKeystroke)
|
candidateBindingSets = @bindingSetsForNode(currentNode, bindingSetsForFirstKeystroke)
|
||||||
for bindingSet in candidateBindingSets
|
for bindingSet in candidateBindingSets
|
||||||
command = bindingSet.commandForEvent(event)
|
command = bindingSet.commandForEvent(event)
|
||||||
if command
|
if command is 'native!'
|
||||||
|
return true
|
||||||
|
else if command
|
||||||
continue if @triggerCommandEvent(event, command)
|
continue if @triggerCommandEvent(event, command)
|
||||||
return false
|
return false
|
||||||
else if command == false
|
else if command == false
|
||||||
|
Loading…
Reference in New Issue
Block a user