From 51736e769527692391e78be5ab70e549e7b3dd85 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 10 Jan 2012 19:22:19 -0800 Subject: [PATCH] Call window.close when window receives the 'close' event. The RootView binds meta-w to the 'close' event. --- spec/atom/window-spec.coffee | 6 ++++++ src/atom/window.coffee | 1 + 2 files changed, 7 insertions(+) diff --git a/spec/atom/window-spec.coffee b/spec/atom/window-spec.coffee index c12487112..bc2282ea6 100644 --- a/spec/atom/window-spec.coffee +++ b/spec/atom/window-spec.coffee @@ -9,6 +9,12 @@ describe "Window", -> afterEach -> window.shutdown() + describe ".close()", -> + it "is triggered by the 'close' event", -> + spyOn window, 'close' + $(window).trigger 'close' + expect(window.close).toHaveBeenCalled() + describe "bindMenuItem(path, keyPattern, action)", -> it "causes the given menu item to be added to the menu when the window is focused and removed when it is blurred", -> addedPaths = [] diff --git a/src/atom/window.coffee b/src/atom/window.coffee index 2a1d6ce1e..6ea9180c9 100644 --- a/src/atom/window.coffee +++ b/src/atom/window.coffee @@ -17,6 +17,7 @@ windowAdditions = $('body').append @rootView @registerEventHandlers() @bindMenuItems() + $(this).on 'close', => @close() $(window).focus() shutdown: ->