Restore test window position after testing setPosition

This commit is contained in:
Nathan Sobo
2015-10-01 16:52:20 -06:00
parent d08180ceb0
commit a87605164b
2 changed files with 7 additions and 4 deletions

View File

@@ -8,6 +8,13 @@ temp = require "temp"
describe "the `atom` global", ->
describe 'window sizing methods', ->
describe '::getPosition and ::setPosition', ->
originalPosition = null
beforeEach ->
originalPosition = atom.getPosition()
afterEach ->
atom.setPosition(originalPosition.x, originalPosition.y)
it 'sets the position of the window, and can retrieve the position just set', ->
atom.setPosition(22, 45)
expect(atom.getPosition()).toEqual x: 22, y: 45

View File

@@ -1,5 +1,4 @@
require '../src/window'
atom.restoreWindowDimensions()
require 'jasmine-json'
require '../vendor/jasmine-jquery'
@@ -31,9 +30,6 @@ commandsToRestore = atom.commands.getSnapshot()
styleElementsToRestore = atom.styles.getSnapshot()
window.addEventListener 'core:close', -> window.close()
window.addEventListener 'beforeunload', ->
atom.storeWindowDimensions()
atom.saveSync()
document.querySelector('html').style.overflow = 'auto'
document.body.style.overflow = 'auto'