mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Meta-s triggers save event with the new css-based keymap.
This commit is contained in:
@@ -63,7 +63,12 @@ describe "Editor", ->
|
||||
editor.getAceSession().insert {row: 0, column: 1}, 'ooo'
|
||||
expect(buffer.getText()).toMatch /^.ooo/
|
||||
|
||||
describe "save", ->
|
||||
describe ".save()", ->
|
||||
it "is triggered by the 'save' event", ->
|
||||
spyOn(editor, 'save')
|
||||
editor.trigger('save')
|
||||
expect(editor.save).toHaveBeenCalled()
|
||||
|
||||
describe "when the current buffer has a url", ->
|
||||
beforeEach ->
|
||||
buffer = new Buffer(tempFilePath)
|
||||
|
||||
@@ -42,7 +42,3 @@ describe "Window", ->
|
||||
|
||||
expect(handler).toHaveBeenCalled()
|
||||
|
||||
describe "menu items", ->
|
||||
it "adds a Save item to the main menu after startup", ->
|
||||
expect(OSX.NSApp.mainMenu.itemWithTitle('File').submenu.itemWithTitle('Save')).not.toBeNull()
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class Editor extends Template
|
||||
@aceSessions = {}
|
||||
@buildAceEditor()
|
||||
@setBuffer(new Buffer)
|
||||
@on 'save', => @save()
|
||||
|
||||
shutdown: ->
|
||||
@destroy()
|
||||
|
||||
@@ -23,9 +23,9 @@ class RootView extends Template
|
||||
initialize: ({url}) ->
|
||||
@globalKeymap = new GlobalKeymap
|
||||
@globalKeymap.bindKeys '*'
|
||||
'meta+s': 'save'
|
||||
'meta+w': 'close'
|
||||
'meta+t': 'find-files'
|
||||
'meta-s': 'save'
|
||||
'meta-w': 'close'
|
||||
'meta-t': 'find-files'
|
||||
|
||||
@editor.keyEventHandler = @globalKeymap
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ windowAdditions =
|
||||
$(window).unbind('blur')
|
||||
|
||||
bindMenuItems: ->
|
||||
@bindMenuItem "File > Save", "meta+s", => @rootView.editor.save()
|
||||
# we want to integrate this better with keybindings
|
||||
# @bindMenuItem "File > Save", "meta+s", => @rootView.editor.save()
|
||||
|
||||
bindMenuItem: (path, pattern, action) ->
|
||||
@menuItemActions[path] = {action: action, pattern: pattern}
|
||||
|
||||
Reference in New Issue
Block a user