Add initial outline view specs

This commit is contained in:
Kevin Sawicki 2012-10-23 16:04:49 -07:00
parent 3152ab7219
commit 8acb37338d

View File

@ -0,0 +1,29 @@
RootView = require 'root-view'
OutlineView = require 'outline-view'
describe "OutlineView", ->
[rootView, outlineView] = []
beforeEach ->
rootView = new RootView(require.resolve('fixtures/coffee.coffee'))
rootView.activateExtension(OutlineView)
outlineView = OutlineView.instance
rootView.attachToDom()
afterEach ->
rootView.deactivate()
it "displays both functions", ->
expect(rootView.find('.outline-view')).not.toExist()
rootView.trigger 'outline-view:toggle'
expect(rootView.find('.outline-view')).toExist()
expect(outlineView.list.children('li').length).toBe 2
expect(outlineView.list.find("li:contains(sort)")).toExist()
expect(outlineView.list.find("li:contains(noop)")).toExist()
expect(outlineView.list.children().first()).toHaveClass 'selected'
it "doesn't display for unsupported languages", ->
rootView.open(require.resolve('fixtures/sample.txt'))
expect(rootView.find('.outline-view')).not.toExist()
rootView.trigger 'outline-view:toggle'
expect(rootView.find('.outline-view')).not.toExist()