فهرست منبع

Fix some of the notebook tests

Saul Shanabrook 6 سال پیش
والد
کامیت
326e0d7d47
1فایلهای تغییر یافته به همراه10 افزوده شده و 3 حذف شده
  1. 10 3
      tests/test-notebook/src/default-toolbar.spec.ts

+ 10 - 3
tests/test-notebook/src/default-toolbar.spec.ts

@@ -190,28 +190,34 @@ describe('@jupyterlab/notebook', () => {
     describe('#createCellTypeItem()', () => {
       it('should track the cell type of the current cell', async () => {
         const item = ToolbarItems.createCellTypeItem(panel);
+        Widget.attach(item, document.body);
+        await framePromise();
         const node = item.node.getElementsByTagName(
           'select'
         )[0] as HTMLSelectElement;
-        await framePromise();
         expect(node.value).to.equal('code');
         panel.content.activeCellIndex++;
         await framePromise();
         expect(node.value).to.equal('markdown');
       });
 
-      it("should display `'-'` if multiple cell types are selected", () => {
+      it("should display `'-'` if multiple cell types are selected", async () => {
         const item = ToolbarItems.createCellTypeItem(panel);
+        Widget.attach(item, document.body);
+        await framePromise();
         const node = item.node.getElementsByTagName(
           'select'
         )[0] as HTMLSelectElement;
         expect(node.value).to.equal('code');
         panel.content.select(panel.content.widgets[1]);
+        await framePromise();
         expect(node.value).to.equal('-');
       });
 
-      it('should display the active cell type if multiple cells of the same type are selected', () => {
+      it('should display the active cell type if multiple cells of the same type are selected', async () => {
         const item = ToolbarItems.createCellTypeItem(panel);
+        Widget.attach(item, document.body);
+        await framePromise();
         const node = item.node.getElementsByTagName(
           'select'
         )[0] as HTMLSelectElement;
@@ -219,6 +225,7 @@ describe('@jupyterlab/notebook', () => {
         const cell = panel.model.contentFactory.createCodeCell({});
         panel.model.cells.insert(1, cell);
         panel.content.select(panel.content.widgets[1]);
+        await framePromise();
         expect(node.value).to.equal('code');
       });
     });