Browse Source

Unbreak tests.

A. Darian 8 years ago
parent
commit
50187cf68c
2 changed files with 9 additions and 9 deletions
  1. 6 6
      src/inspector/handler.ts
  2. 3 3
      src/notebook/notebook/actions.ts

+ 6 - 6
src/inspector/handler.ts

@@ -127,25 +127,25 @@ class InspectionHandler implements IDisposable, Inspector.IInspectable {
    * See [Payloads (DEPRECATED)](http://jupyter-client.readthedocs.io/en/latest/messaging.html#payloads-deprecated).
    */
   execute(content: KernelMessage.IExecuteOkReply): void {
-    let inspectorUpdate: Inspector.IInspectorUpdate = {
+    let update: Inspector.IInspectorUpdate = {
       content: null,
       type: 'details'
     };
 
-    if (!content) {
-      this.inspected.emit(inspectorUpdate);
+    if (!content || !content.payload || !content.payload.length) {
+      this.inspected.emit(update);
       return;
     }
 
     let details = content.payload.filter(i => (i as any).source === 'page')[0];
     if (details) {
       let bundle = (details as any).data as MimeMap<string>;
-      inspectorUpdate.content = this._rendermime.render(bundle);
-      this.inspected.emit(inspectorUpdate);
+      update.content = this._rendermime.render(bundle);
+      this.inspected.emit(update);
       return;
     }
 
-    this.inspected.emit(inspectorUpdate);
+    this.inspected.emit(update);
   }
 
   /**

+ 3 - 3
src/notebook/notebook/actions.ts

@@ -856,11 +856,11 @@ namespace Private {
     case 'code':
       if (kernel) {
         return (child as CodeCellWidget).execute(kernel).then(reply => {
-          if (!reply) {
-            parent.inspectionHandler.execute(null);
-          } else if (reply.content.status === 'ok') {
+          if (reply && reply.content.status === 'ok') {
             let content = reply.content as KernelMessage.IExecuteOkReply;
             parent.inspectionHandler.execute(content);
+          } else {
+            parent.inspectionHandler.execute(null);
           }
           return reply ? reply.content.status === 'ok' : true;
         });