Only load TextMate packages as needed in specs

Also: when a TextMate package is deactivated, remove its grammars
This commit is contained in:
Corey Johnson & Nathan Sobo
2013-03-25 17:31:01 -06:00
committed by Nathan Sobo
parent 8340a084d3
commit 8437f3ff7f
14 changed files with 70 additions and 20 deletions

View File

@@ -9,13 +9,11 @@ Package = require 'package'
describe "Snippets extension", ->
[buffer, editor, editSession] = []
beforeEach ->
atom.activatePackage('javascript.tmbundle', sync: true)
window.rootView = new RootView
rootView.open('sample.js')
packageWithSnippets = atom.loadPackage("package-with-snippets")
spyOn(atom, "getLoadedPackages").andCallFake ->
textMatePackages = window.textMatePackages.filter (pack) -> /package-with-a-cson-grammar|test|textmate-package|javascript/.test(pack.name)
textMatePackages.concat([packageWithSnippets])
spyOn(require("snippets/lib/snippets"), 'loadAll')
atom.activatePackage("snippets")
@@ -238,6 +236,9 @@ describe "Snippets extension", ->
describe "snippet loading", ->
beforeEach ->
atom.loadPackage('textmate-package.tmbundle', sync: true)
atom.loadPackage('package-with-snippets')
jasmine.unspy(window, "setTimeout")
jasmine.unspy(snippets, 'loadAll')
spyOn(snippets, 'loadAtomSnippets').andCallFake (path, done) -> done()

View File

@@ -4,6 +4,8 @@ describe "Spell check", ->
[editor] = []
beforeEach ->
atom.activatePackage('text.tmbundle', sync: true)
atom.activatePackage('javascript.tmbundle', sync: true)
window.rootView = new RootView
rootView.open('sample.js')
config.set('spell-check.grammars', [])

View File

@@ -180,6 +180,11 @@ describe "StatusBar", ->
expect(statusBar.gitStatusIcon).toHaveText('+1')
describe "grammar label", ->
beforeEach ->
atom.activatePackage('text.tmbundle', sync: true)
atom.activatePackage('javascript.tmbundle', sync: true)
syntax.trigger 'grammars-loaded'
it "displays the name of the current grammar", ->
expect(statusBar.find('.grammar-name').text()).toBe 'JavaScript'