Call Pane.destroyItem when close icon is clicked on a tab

This commit is contained in:
Nathan Sobo
2013-02-26 14:25:00 -07:00
committed by probablycorey
parent 7aba839dac
commit 47621bd3b2
2 changed files with 6 additions and 5 deletions

View File

@@ -39,7 +39,7 @@ class TabBarView extends SortableList
@on 'click', '.tab .close-icon', (e) =>
tab = $(e.target).closest('.tab').view()
@pane.removeItem(tab.item)
@pane.destroyItem(tab.item)
false
@pane.prepend(this)

View File

@@ -89,12 +89,13 @@ fdescribe "TabBarView", ->
expect(pane.focus.callCount).toBe 2
describe "when a tab's close icon is clicked", ->
it "removes the tab's item from the pane", ->
tabBar.tabForItem(item1).find('.close-icon').click()
it "destroys the tab's item on the pane", ->
tabBar.tabForItem(editSession1).find('.close-icon').click()
expect(pane.getItems().length).toBe 2
expect(pane.getItems().indexOf(item1)).toBe -1
expect(pane.getItems().indexOf(editSession1)).toBe -1
expect(editSession1.destroyed).toBeTruthy()
expect(tabBar.getTabs().length).toBe 2
expect(tabBar.find('.tab:contains(Item 1)')).not.toExist()
expect(tabBar.find('.tab:contains(sample.js)')).not.toExist()
describe "when a tab item's title changes", ->
it "updates the title of the item's tab", ->