|
@@ -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');
|
|
|
});
|
|
|
});
|