               expandedView.expand()
 
               treeView.attachToDom()
-              newPath = path.join(dirPath, "new2/")
-              addDialog.miniEditor.insertText("new2/")
+              newPath = path.join(dirPath, "new2") + path.sep
+              addDialog.miniEditor.insertText("new2#{path.sep}")
               addDialog.trigger 'core:confirm'
               expect(fs.isDirectorySync(newPath)).toBeTruthy()
               expect(addDialog.parent()).not.toExist()

              expect(atom.workspaceView.getActiveView().isFocused).toBeFalsy()
              expect(dirView.find('.directory.selected:contains(new)').length).toBe 1

        describe "when the path with a trailing '/' is changed and confirmed", ->
          describe "when no directory exists at the given path", ->
            it "adds a directory and closes the dialog", ->
              treeView.attachToDom()
              newPath = path.join(dirPath, "new/dir")
              addDialog.miniEditor.insertText("new/dir/")
              addDialog.trigger 'core:confirm'
              expect(fs.isDirectorySync(newPath)).toBeTruthy()
              expect(addDialog.parent()).not.toExist()

            it "shows an error message and does not close the dialog", ->
              newPath = path.join(dirPath, "new-dir")
              fs.makeTreeSync(newPath)
              addDialog.miniEditor.insertText("new-dir#{path.sep}")
              addDialog.trigger 'core:confirm'

              expect(addDialog.errorMessage.text()).toContain 'already exists'
