mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Move ::activateItemAtIndex specs from pane-view-spec to pane-spec
This commit is contained in:
@@ -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] = []
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user