Forráskód Böngészése

Reinstate tests and fix refresh guard

Steven Silvester 8 éve
szülő
commit
6b68069505
2 módosított fájl, 31 hozzáadás és 27 törlés
  1. 8 4
      src/filebrowser/model.ts
  2. 23 23
      test/src/index.ts

+ 8 - 4
src/filebrowser/model.ts

@@ -114,16 +114,20 @@ class FileBrowserModel implements IDisposable {
    *
    * @returns A promise with the contents of the directory.
    */
-  cd(newValue = ''): Promise<void> {
-    if (newValue !== '') {
+  cd(newValue = '.'): Promise<void> {
+    if (newValue !== '.') {
       newValue = Private.normalizePath(this._model.path, newValue);
     }
     // Collapse requests to the same directory.
     if (newValue === this._pendingPath) {
-      return this._pending;
+      return Promise.resolve(void 0);
     }
     let oldValue = this.path;
     let options = { content: true };
+    this._pendingPath = newValue;
+    if (newValue === '.') {
+      newValue = '';
+    }
     this._pending = this._manager.contents.get(newValue, options).then(contents => {
       this._model = contents;
       return this._findSessions();
@@ -135,9 +139,9 @@ class FileBrowserModel implements IDisposable {
           newValue
         });
       }
+      this._pendingPath = '';
       this.refreshed.emit(void 0);
     });
-    this._pendingPath = newValue;
     return this._pending;
   }
 

+ 23 - 23
test/src/index.ts

@@ -1,35 +1,35 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-// import './dialog/dialog.spec';
+import './dialog/dialog.spec';
 
-// import './docregistry/default.spec';
+import './docregistry/default.spec';
 
 import './filebrowser/model.spec';
 
-// import './renderers/renderers.spec';
-// import './renderers/latex.spec';
+import './renderers/renderers.spec';
+import './renderers/latex.spec';
 
-// import './rendermime/rendermime.spec';
+import './rendermime/rendermime.spec';
 
-// import './notebook/cells/editor.spec';
-// import './notebook/cells/model.spec';
-// import './notebook/cells/widget.spec';
+import './notebook/cells/editor.spec';
+import './notebook/cells/model.spec';
+import './notebook/cells/widget.spec';
 
-// import './notebook/completion/handler.spec';
-// import './notebook/completion/model.spec';
-// import './notebook/completion/widget.spec';
+import './notebook/completion/handler.spec';
+import './notebook/completion/model.spec';
+import './notebook/completion/widget.spec';
 
-// import './notebook/notebook/actions.spec';
-// import './notebook/notebook/default-toolbar.spec';
-// import './notebook/notebook/model.spec';
-// import './notebook/notebook/modelfactory.spec';
-// import './notebook/notebook/nbformat.spec';
-// import './notebook/notebook/panel.spec';
-// import './notebook/notebook/toolbar.spec';
-// import './notebook/notebook/trust.spec';
-// import './notebook/notebook/widget.spec';
-// import './notebook/notebook/widgetfactory.spec';
+import './notebook/notebook/actions.spec';
+import './notebook/notebook/default-toolbar.spec';
+import './notebook/notebook/model.spec';
+import './notebook/notebook/modelfactory.spec';
+import './notebook/notebook/nbformat.spec';
+import './notebook/notebook/panel.spec';
+import './notebook/notebook/toolbar.spec';
+import './notebook/notebook/trust.spec';
+import './notebook/notebook/widget.spec';
+import './notebook/notebook/widgetfactory.spec';
 
-// import './notebook/output-area/model.spec';
-// import './notebook/output-area/widget.spec';
+import './notebook/output-area/model.spec';
+import './notebook/output-area/widget.spec';