2011-12-15 04:24:30 +04:00
|
|
|
App = require 'app'
|
2011-12-16 02:13:34 +04:00
|
|
|
fs = require 'fs'
|
2011-12-13 04:24:55 +04:00
|
|
|
|
2012-02-29 01:14:35 +04:00
|
|
|
describe "App", ->
|
2011-12-15 04:24:30 +04:00
|
|
|
afterEach ->
|
2012-02-29 05:24:58 +04:00
|
|
|
window.close() for window in atom.windows
|
|
|
|
waitsFor "there to be no windows", ->
|
|
|
|
atom.windows.length == 0
|
2011-12-13 04:24:55 +04:00
|
|
|
|
2011-12-15 04:24:30 +04:00
|
|
|
describe "open", ->
|
2012-01-04 22:51:41 +04:00
|
|
|
describe "when opening a filePath", ->
|
2012-01-05 23:20:18 +04:00
|
|
|
it "displays it in a new window with the contents of the file loaded", ->
|
2012-02-29 05:24:58 +04:00
|
|
|
filePath = null
|
|
|
|
|
|
|
|
runs ->
|
|
|
|
filePath = require.resolve 'fixtures/sample.txt'
|
|
|
|
expect(atom.windows.length).toBe 0
|
|
|
|
|
|
|
|
atom.open filePath
|
2011-12-13 04:24:55 +04:00
|
|
|
|
2012-02-29 05:24:58 +04:00
|
|
|
waitsFor "window to open", (windowOpened) ->
|
|
|
|
atom.on "open", ->
|
|
|
|
expect(atom.windows.length).toBe 1
|
|
|
|
newWindow = atom.windows[0]
|
|
|
|
expect(newWindow.rootView.editor.buffer.url).toEqual filePath
|
|
|
|
expect(newWindow.rootView.editor.buffer.getText()).toEqual fs.read(filePath)
|
2011-12-13 04:24:55 +04:00
|
|
|
|
2012-02-29 05:24:58 +04:00
|
|
|
windowOpened()
|
2012-01-04 22:51:41 +04:00
|
|
|
|