Update atom specs

This commit is contained in:
probablycorey 2013-05-22 15:31:59 -07:00
parent 102068f9e5
commit 7f083acdc4
2 changed files with 15 additions and 20 deletions

View File

@ -3,6 +3,7 @@ RootView = require 'root-view'
{$$} = require 'space-pen'
fsUtils = require 'fs-utils'
Exec = require('child_process').exec
path = require('path')
describe "the `atom` global", ->
beforeEach ->
@ -24,7 +25,7 @@ describe "the `atom` global", ->
describe "when the package has a main module", ->
describe "when the metadata specifies a main module path˜", ->
it "requires the module at the specified path", ->
mainModule = require('package-with-main/main-module')
mainModule = require('fixtures/packages/package-with-main/main-module')
spyOn(mainModule, 'activate')
pack = atom.activatePackage('package-with-main')
expect(mainModule.activate).toHaveBeenCalled()
@ -32,7 +33,7 @@ describe "the `atom` global", ->
describe "when the metadata does not specify a main module", ->
it "requires index.coffee", ->
indexModule = require('package-with-index/index')
indexModule = require('fixtures/packages/package-with-index/index')
spyOn(indexModule, 'activate')
pack = atom.activatePackage('package-with-index')
expect(indexModule.activate).toHaveBeenCalled()
@ -48,7 +49,7 @@ describe "the `atom` global", ->
[mainModule, pack] = []
beforeEach ->
mainModule = require 'package-with-activation-events/index'
mainModule = require 'fixtures/packages/package-with-activation-events/index'
spyOn(mainModule, 'activate').andCallThrough()
AtomPackage = require 'atom-package'
spyOn(AtomPackage.prototype, 'requireMainModule').andCallThrough()
@ -130,9 +131,9 @@ describe "the `atom` global", ->
describe "stylesheet loading", ->
describe "when the metadata contains a 'stylesheets' manifest", ->
it "loads stylesheets from the stylesheets directory as specified by the manifest", ->
one = fsUtils.resolveOnLoadPath("package-with-stylesheets-manifest/stylesheets/1.css")
two = fsUtils.resolveOnLoadPath("package-with-stylesheets-manifest/stylesheets/2.less")
three = fsUtils.resolveOnLoadPath("package-with-stylesheets-manifest/stylesheets/3.css")
one = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css")
two = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less")
three = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css")
expect(stylesheetElementForId(one)).not.toExist()
expect(stylesheetElementForId(two)).not.toExist()
expect(stylesheetElementForId(three)).not.toExist()
@ -146,9 +147,9 @@ describe "the `atom` global", ->
describe "when the metadata does not contain a 'stylesheets' manifest", ->
it "loads all stylesheets from the stylesheets directory", ->
one = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/1.css")
two = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/2.less")
three = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/3.css")
one = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/1.css")
two = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/2.less")
three = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/3.css")
expect(stylesheetElementForId(one)).not.toExist()
expect(stylesheetElementForId(two)).not.toExist()
expect(stylesheetElementForId(three)).not.toExist()
@ -254,15 +255,9 @@ describe "the `atom` global", ->
atom.deactivatePackage('ruby.tmbundle')
expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined()
describe ".getVersion(callback)", ->
it "calls the callback with the current version number", ->
versionHandler = jasmine.createSpy("versionHandler")
atom.getVersion(versionHandler)
waitsFor ->
versionHandler.callCount > 0
runs ->
expect(versionHandler.argsForCall[0][0]).toBeDefined()
describe ".getVersion", ->
it "returns the current version number", ->
expect(atom.getVersion()).toBeInstanceOf String
describe "modal native dialogs", ->
beforeEach ->

View File

@ -259,5 +259,5 @@ window.atom =
catch error
console.error "Failed to load `#{userInitScriptPath}`", error.stack, error
getVersion: (callback) ->
@sendMessageToBrowserProcess('getVersion', null, callback)
getVersion: ->
@sendMessageToBrowserProcess('getVersion')