fix window blur and focus events

This commit is contained in:
Justin Palmer & Nathan Sobo
2013-02-05 12:03:56 -08:00
parent 44df146034
commit 65927ea0cf
3 changed files with 21 additions and 16 deletions

View File

@@ -13,14 +13,24 @@ describe "Window", ->
atom.setRootViewStateForPath(rootView.project.getPath(), null)
$(window).off 'beforeunload'
describe "window is loaded", ->
describe "when the window is loaded", ->
it "doesn't have .is-blurred on the body tag", ->
$(window).trigger 'window:focus'
expect($("body").hasClass("is-blurred")).toBe false
expect($("body")).not.toHaveClass("is-blurred")
it "does have .is-blurred on the window blur event", ->
$(window).trigger 'window:blur'
expect($("body").hasClass("is-blurred")).toBe true
fdescribe "when the window is blurred", ->
beforeEach ->
$(window).trigger 'blur'
afterEach ->
$('body').removeClass('is-blurred')
it "adds the .is-blurred class on the body", ->
expect($("body")).toHaveClass("is-blurred")
describe "when the window is focused again", ->
it "removes the .is-blurred class from the body", ->
$(window).trigger 'focus'
expect($("body")).not.toHaveClass("is-blurred")
describe ".close()", ->
it "is triggered by the 'core:close' event", ->