pulsar/spec/atom/app-spec.coffee

28 lines
731 B
CoffeeScript
Raw Normal View History

App = require 'app'
fs = require 'fs'
2011-12-13 04:24:55 +04:00
describe "App", ->
app = null
2011-12-13 04:24:55 +04:00
beforeEach ->
app = new App()
2011-12-13 04:24:55 +04:00
afterEach ->
window.close() for window in app.windows()
waitsFor ->
app.windows().length == 0
2011-12-13 04:24:55 +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-01-04 22:51:41 +04:00
filePath = require.resolve 'fixtures/sample.txt'
expect(app.windows().length).toBe 0
2011-12-13 04:24:55 +04:00
2012-01-04 22:51:41 +04:00
app.open filePath
2011-12-13 04:24:55 +04:00
2012-01-04 22:51:41 +04:00
expect(app.windows().length).toBe 1
2012-01-05 03:25:57 +04:00
newWindow = app.windows()[0]
2012-01-04 22:51:41 +04:00
expect(newWindow.rootView.editor.buffer.url).toEqual filePath
expect(newWindow.rootView.editor.buffer.getText()).toEqual fs.read(filePath)