Browse Source

review comments, fixing celltools tests

Stephanie Stattel 6 years ago
parent
commit
0946986f2b

+ 7 - 7
packages/notebook-extension/src/index.ts

@@ -334,16 +334,16 @@ function activateCellTools(
         }
       });
       const nbConvert = CellTools.createNBConvertSelector(optionsMap);
-      celltools.title.iconClass = 'jp-BuildIcon jp-SideBar-tabIcon';
-      celltools.title.caption = 'Cell Inspector';
-      celltools.id = id;
-      celltools.addItem({ tool: activeCellTool, rank: 1 });
-      celltools.addItem({ tool: slideShow, rank: 2 });
       celltools.addItem({ tool: nbConvert, rank: 3 });
-      celltools.addItem({ tool: metadataEditor, rank: 4 });
-      MessageLoop.installMessageHook(celltools, hook);
     }
   });
+  celltools.title.iconClass = 'jp-BuildIcon jp-SideBar-tabIcon';
+  celltools.title.caption = 'Cell Inspector';
+  celltools.id = id;
+  celltools.addItem({ tool: activeCellTool, rank: 1 });
+  celltools.addItem({ tool: slideShow, rank: 2 });
+  celltools.addItem({ tool: metadataEditor, rank: 4 });
+  MessageLoop.installMessageHook(celltools, hook);
 
   // Wait until the application has finished restoring before rendering.
   Promise.all([state.fetch(id), app.restored]).then(([args]) => {

+ 21 - 2
tests/test-notebook/src/celltools.spec.ts

@@ -7,6 +7,8 @@ import { Message } from '@phosphor/messaging';
 
 import { TabPanel, Widget } from '@phosphor/widgets';
 
+import { JSONValue } from '@phosphor/coreutils';
+
 import { simulate } from 'simulate-event';
 
 import { CodeMirrorEditorFactory } from '@jupyterlab/codemirror';
@@ -413,7 +415,16 @@ describe('@jupyterlab/notebook', () => {
 
     describe('CellTools.createNBConvertSelector()', () => {
       it('should create a raw mimetype selector', () => {
-        const tool = CellTools.createNBConvertSelector();
+        let optionsMap: { [key: string]: JSONValue } = {
+          None: '-',
+          LaTeX: 'text/latex',
+          reST: 'text/restructuredtext',
+          HTML: 'text/html',
+          Markdown: 'text/markdown',
+          Python: 'text/x-python'
+        };
+        optionsMap.None = '-';
+        const tool = CellTools.createNBConvertSelector(optionsMap);
         tool.selectNode.selectedIndex = -1;
         celltools.addItem({ tool });
         simulate(panel0.node, 'focus');
@@ -433,7 +444,15 @@ describe('@jupyterlab/notebook', () => {
       });
 
       it('should have no effect on a code cell', () => {
-        const tool = CellTools.createNBConvertSelector();
+        let optionsMap: { [key: string]: JSONValue } = {
+          None: '-',
+          LaTeX: 'text/latex',
+          reST: 'text/restructuredtext',
+          HTML: 'text/html',
+          Markdown: 'text/markdown',
+          Python: 'text/x-python'
+        };
+        const tool = CellTools.createNBConvertSelector(optionsMap);
         tool.selectNode.selectedIndex = -1;
         celltools.addItem({ tool });
         simulate(panel0.node, 'focus');