Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 4eea2f1

Browse files
committed
Merge pull request #618 from glangford/issue-498
Update folder git status colour after delete
2 parents 910e460 + c4e6e3e commit 4eea2f1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/tree-view.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,8 @@ class TreeView extends View
525525
"Move to Trash": ->
526526
for selectedPath in selectedPaths
527527
shell.moveItemToTrash(selectedPath)
528+
if repo = repoForPath(selectedPath)
529+
repo.getPathStatus(selectedPath)
528530
"Cancel": null
529531

530532
# Public: Copy the path of the selected entry element.

spec/tree-view-spec.coffee

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,6 +2257,26 @@ describe "TreeView", ->
22572257
it "adds a custom style", ->
22582258
expect(treeView.find('.file:contains(ignored.txt)')).toHaveClass 'status-ignored'
22592259

2260+
describe "when a file is selected in a directory", ->
2261+
beforeEach ->
2262+
jasmine.attachToDOM(workspaceElement)
2263+
treeView.focus()
2264+
element.expand() for element in treeView.find('.directory')
2265+
fileView = treeView.find('.file:contains(new2)')
2266+
expect(fileView).not.toBeNull()
2267+
fileView.click()
2268+
2269+
describe "when the file is deleted", ->
2270+
it "updates the style of the directory", ->
2271+
expect(treeView.selectedEntry().getPath()).toContain(path.join('dir2', 'new2'))
2272+
dirView = $(treeView.roots[0].entries).find('.directory:contains(dir2)')
2273+
expect(dirView).not.toBeNull()
2274+
spyOn(dirView[0].directory, 'updateStatus')
2275+
spyOn(atom, 'confirm').andCallFake (dialog) ->
2276+
dialog.buttons["Move to Trash"]()
2277+
atom.commands.dispatch(treeView.element, 'tree-view:remove')
2278+
expect(dirView[0].directory.updateStatus).toHaveBeenCalled()
2279+
22602280
describe "when the project is a symbolic link to the repository root", ->
22612281
beforeEach ->
22622282
symlinkPath = temp.path('tree-view-project')

0 commit comments

Comments
 (0)