All files / src labcompat.ts

100% Statements 4/4
100% Branches 2/2
100% Functions 3/3
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18            120x       2160x       1414x 1414x    
import type { ICellModel } from '@jupyterlab/cells';
import type { INotebookModel } from '@jupyterlab/notebook';
import { toArray } from '@lumino/algorithm';
import type { DockPanel, TabBar, Widget } from '@lumino/widgets';
 
export function getTabBars(dockPanel: DockPanel): TabBar<Widget>[] {
  return toArray(dockPanel.tabBars());
}
 
export function getCellModels(notebookModel: INotebookModel): ICellModel[] {
  return toArray(notebookModel.cells);
}
 
export function getSelectedWidget(dockPanel: DockPanel): Widget | null {
  const selectedWidgets = toArray(dockPanel.selectedWidgets());
  return selectedWidgets.length ? selectedWidgets[0] : null;
}