diff --git a/plugins/c9.fs/fs.cache.xml.js b/plugins/c9.fs/fs.cache.xml.js index 73523999..6c780202 100644 --- a/plugins/c9.fs/fs.cache.xml.js +++ b/plugins/c9.fs/fs.cache.xml.js @@ -266,7 +266,7 @@ define(function(require, exports, module) { function removeSingleNode(e) { var node = findNode(e.path); - if (!node) return; //Node doesn't exist + if (!node) return; // Node doesn't exist deleteNode(node); emit("remove", { @@ -274,8 +274,9 @@ define(function(require, exports, module) { node: node }); - // todo e.undo = function(){ + if (this.error && this.error.code == "ENOENT") + return; createNode(node.path, null, node); emit("add", { path: node.path, @@ -668,6 +669,11 @@ define(function(require, exports, module) { }); return; } + if (orphans[node.path] == node) { + delete orphans[node.path]; + if (parent.map[node.label] != node) + return; + } silent || model._signal("remove", node); var wasOpen = startUpdate(parent); delete parent.map[node.label]; diff --git a/plugins/c9.ide.tree/tree_test.js b/plugins/c9.ide.tree/tree_test.js index 1aa41a44..9c49a2df 100644 --- a/plugins/c9.ide.tree/tree_test.js +++ b/plugins/c9.ide.tree/tree_test.js @@ -25,7 +25,8 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.core/util", { packagePath: "plugins/c9.core/settings", - settings: "default" + settings: "default", + testing: true }, "plugins/c9.core/api.js", { @@ -53,16 +54,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], "plugins/c9.ide.dialog.common/fileremove", "plugins/c9.ide.dialog.common/question", - //Mock Plugins - { - consumes: ["apf", "ui", "Plugin"], - provides: [ - "commands", "panels", "tabManager", "layout", "watcher", - "preferences", "clipboard", "Panel", "auth.bootstrap", "info", - "proc", "focusManager", "dialog.error", "error_handler" - ], - setup: expect.html.mocked - }, { consumes: ["tree", "fs", "fs.cache", "tabManager", "ui", "dialog.question", "dialog.alert"], @@ -85,7 +76,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"], function getDomNode(treeNode) { var r = tree.tree.renderer; r.$renderChanges(r.$loop.changes); - var i = r.provider.getIndexForNode(treeNode) + var i = r.provider.getIndexForNode(treeNode); return r.$cellLayer.getDomNodeAtIndex(i); }