This commit is contained in:
Machiste Quintana
2015-04-15 13:12:38 -04:00
parent 0cb00a8de8
commit 8d0168a520
2 changed files with 10 additions and 6 deletions

View File

@@ -121,19 +121,23 @@ describe "PaneView", ->
describe "when the new activeItem implements ::getPath", ->
beforeEach ->
paneModel.activateItem(editor1)
it "adds its file path to the active pane", ->
expect(pane).toHaveAttr('data-active-path')
expect(pane).toHaveAttr('data-active-item-path')
it "adds its file name to the active pane", ->
expect(pane).toHaveAttr('data-active-name')
expect(pane).toHaveAttr('data-active-item-name')
describe "when the new activeItem does not implement ::getPath", ->
beforeEach ->
paneModel.activateItem(editor1)
paneModel.activateItem(document.createElement('div'))
it "removes its file path from the active pane", ->
expect(pane).not.toHaveAttr('data-active-path')
expect(pane).not.toHaveAttr('data-active-item-path')
it "removes its file name from the active pane", ->
expect(pane).not.toHaveAttr('data-active-name')
expect(pane).not.toHaveAttr('data-active-item-name')
describe "when an item is destroyed", ->
it "triggers the 'pane:item-removed' event with the item and its former index", ->

View File

@@ -73,8 +73,8 @@ class PaneElement extends HTMLElement
if itemPath = item.getPath?()
path = require 'path'
@dataset.activeName = path.basename(itemPath)
@dataset.activePath = itemPath
@dataset.activeItemName = path.basename(itemPath)
@dataset.activeItemPath = itemPath
else
delete @dataset.activeName
delete @dataset.activePath