Move ::activateItemAtIndex specs from pane-view-spec to pane-spec

This commit is contained in:
Nathan Sobo
2014-01-14 19:49:15 -07:00
parent 83696bb9c7
commit d8ddd52df8
2 changed files with 17 additions and 9 deletions

View File

@@ -44,6 +44,23 @@ describe "Pane", ->
pane.activateNextItem()
expect(pane.activeItem).toBe item1
describe "::activateItemAtIndex(index)", ->
it "activates the item at the given index", ->
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
[item1, item2, item3] = pane.items
pane.activateItemAtIndex(2)
expect(pane.activeItem).toBe item3
pane.activateItemAtIndex(1)
expect(pane.activeItem).toBe item2
pane.activateItemAtIndex(0)
expect(pane.activeItem).toBe item1
# Doesn't fail with out-of-bounds indices
pane.activateItemAtIndex(100)
expect(pane.activeItem).toBe item1
pane.activateItemAtIndex(-1)
expect(pane.activeItem).toBe item1
describe "::destroyItem(item)", ->
[pane, item1, item2, item3] = []

View File

@@ -138,15 +138,6 @@ describe "PaneView", ->
paneModel2.activateItemAtIndex(1)
expect(view1.data('preservative')).toBe 1234
describe "pane:show-item-N events", ->
it "shows the (n-1)th item if it exists", ->
pane.trigger 'pane:show-item-2'
expect(pane.activeItem).toBe pane.itemAtIndex(1)
pane.trigger 'pane:show-item-1'
expect(pane.activeItem).toBe pane.itemAtIndex(0)
pane.trigger 'pane:show-item-9' # don't fail on out-of-bounds indices
expect(pane.activeItem).toBe pane.itemAtIndex(0)
describe "when the title of the active item changes", ->
it "emits pane:active-item-title-changed", ->
activeItemTitleChangedHandler = jasmine.createSpy("activeItemTitleChangedHandler")