本文整理汇总了TypeScript中@jupyterlab/mainmenu.JupyterLabMenu.addGroup方法的典型用法代码示例。如果您正苦于以下问题:TypeScript JupyterLabMenu.addGroup方法的具体用法?TypeScript JupyterLabMenu.addGroup怎么用?TypeScript JupyterLabMenu.addGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/mainmenu.JupyterLabMenu
的用法示例。
在下文中一共展示了JupyterLabMenu.addGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should return a disposable that can be used to remove the group', () => {
const group1 = [{ command: 'run1' }, { command: 'run2' }];
const group2 = [{ command: 'run3' }, { command: 'run4' }];
const disposable = menu.addGroup(group1);
menu.addGroup(group2);
disposable.dispose();
const idx1 = ArrayExt.findFirstIndex(
menu.menu.items,
m => m.command === 'run1'
);
const idx2 = ArrayExt.findFirstIndex(
menu.menu.items,
m => m.command === 'run2'
);
const idx3 = ArrayExt.findFirstIndex(
menu.menu.items,
m => m.command === 'run3'
);
const idx4 = ArrayExt.findFirstIndex(
menu.menu.items,
m => m.command === 'run4'
);
expect(idx1).to.equal(-1);
expect(idx2).to.equal(-1);
expect(idx3 === -1).to.equal(false);
expect(idx4 === -1).to.equal(false);
});
示例2: it
it('should take a rank as an option', () => {
menu.addGroup([ { command: 'run1'}, { command: 'run2' }], 2);
menu.addGroup([ { command: 'run3'}, { command: 'run4' }], 1);
let idx1 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run1');
let idx2 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run2');
let idx3 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run3');
let idx4 = ArrayExt.findFirstIndex(menu.menu.items,
m => m.command === 'run4');
expect(idx3 < idx4).to.be(true);
expect(idx4 < idx1).to.be(true);
expect(idx1 < idx2).to.be(true);
});