Skip to content

Commit

Permalink
adding initial spec, with one test.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddavison committed Jun 29, 2014
1 parent cc934d0 commit 71795df
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: objective-c

notifications:
email:
on_success: never
on_failure: change

script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh'
2 changes: 2 additions & 0 deletions spec/fixtures/sample.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addition = (a,b) ->
a+b
59 changes: 59 additions & 0 deletions spec/sublime-tabs-spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{$, WorkspaceView, View} = require 'atom'
_ = require 'underscore-plus'
path = require 'path'
SublimeTabBarView = require '../lib/sublime-tab-bar-view'
SublimeTabView = require '../lib/sublime-tab-view'

describe "Sublime Tabs Package", ->
beforeEach: ->
atom.workspaceView = new WorkspaceView

waitsForPromise ->
atom.workspace.open('sample.coffee')

waitsForPromise ->
atom.packages.activatePackage('sublime-tabs')

describe 'SublimeTabBarView', ->
[item1, item2, editor1, pane, tabBar] = []

class TestView extends View
@deserialize: ({title, longTitle, iconName}) -> new TestView(title, longTitle, iconName)
@content: (title) -> @div title
initialize: (@title, @longTitle, @iconName) ->
getTitle: -> @title
getLongTitle: -> @longTitle
getIconName: -> @iconName
serialize: -> { deserializer: 'TestView', @title, @longTitle, @iconName }

beforeEach ->
atom.workspaceView = new WorkspaceView
atom.workspace = atom.workspaceView.model
atom.deserializers.add(TestView)
item1 = new TestView('Item 1', undefined, 'squirrel')
item2 = new TestView('Item 2')

waitsForPromise ->
atom.workspace.open('sample.coffee')

runs ->
editor1 = atom.workspace.getActiveEditor()
pane = atom.workspaceView.getActivePaneView()
pane.addItem(item1, 0)
pane.addItem(item2, 2)
pane.activateItem(item2)
tabBar = new SublimeTabBarView(pane)

afterEach ->
atom.deserializers.remove(TestView)

describe 'Temporary Tabs', ->
it 'adds a temp class when opening a file', ->
editor2 = null

waitsForPromise ->
atom.project.open('sample.txt').then (o) -> editor2 = o

runs ->
pane.activateItem(editor2)
expect(tabBar.tabForItem(editor2)).toHaveClass 'temp'

0 comments on commit 71795df

Please sign in to comment.