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: ->