Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
activate: (app: JupyterLab, palette: ICommandPalette): IMainMenu => {
let menu = new MainMenu(app.commands);
menu.id = 'jp-MainMenu';
let logo = new Widget();
logo.addClass('jp-MainAreaPortraitIcon');
logo.addClass('jp-JupyterIcon');
logo.id = 'jp-MainLogo';
let quitButton = PageConfig.getOption('quit_button');
menu.fileMenu.quitEntry = quitButton === 'True';
// Create the application menus.
createEditMenu(app, menu.editMenu);
createFileMenu(app, menu.fileMenu);
createKernelMenu(app, menu.kernelMenu);
createRunMenu(app, menu.runMenu);
createSettingsMenu(app, menu.settingsMenu);
activate: (
app: JupyterFrontEnd,
palette: ICommandPalette,
router: IRouter,
inspector: IInspector | null,
labShell: ILabShell | null
): IMainMenu => {
const { commands } = app;
let menu = new MainMenu(commands);
menu.id = 'jp-MainMenu';
let logo = new Widget();
logo.addClass('jp-MainAreaPortraitIcon');
logo.addClass('jp-JupyterIcon');
logo.id = 'jp-MainLogo';
// Only add quit button if the back-end supports it by checking page config.
let quitButton = PageConfig.getOption('quitButton');
menu.fileMenu.quitEntry = quitButton === 'True';
// Create the application menus.
createEditMenu(app, menu.editMenu);
createFileMenu(app, menu.fileMenu, router, inspector);
createKernelMenu(app, menu.kernelMenu);
createRunMenu(app, menu.runMenu);
it('should construct a new main menu', () => {
const menu = new MainMenu(new CommandRegistry());
expect(menu).to.be.an.instanceof(MainMenu);
});
});
it('should accept useSeparators as an option', () => {
const menu1 = new JupyterLabMenu({ commands }, false);
const menu2 = new JupyterLabMenu({ commands }, true);
menu1.addGroup([{ command: 'run1' }, { command: 'run2' }]);
menu2.addGroup([{ command: 'run1' }, { command: 'run2' }]);
expect(menu1.menu.items.length).to.equal(2);
expect(menu2.menu.items.length).to.equal(4);
});
});
it('should accept useSeparators as an option', () => {
const menu1 = new JupyterLabMenu({ commands }, false);
const menu2 = new JupyterLabMenu({ commands }, true);
menu1.addGroup([{ command: 'run1' }, { command: 'run2' }]);
menu2.addGroup([{ command: 'run1' }, { command: 'run2' }]);
expect(menu1.menu.items.length).to.equal(2);
expect(menu2.menu.items.length).to.equal(4);
});
});
beforeEach(() => {
mainMenu = new MainMenu(commands);
});
beforeEach(() => {
menu = new JupyterLabMenu({ commands });
});
beforeEach(() => {
wodget = new Wodget();
menu = new EditMenu({ commands });
tracker = new WidgetTracker({ namespace: 'wodget' });
void tracker.add(wodget);
});
beforeEach(() => {
wodget = new Wodget();
menu = new EditMenu({ commands });
tracker = new InstanceTracker({ namespace: 'wodget' });
void tracker.add(wodget);
});
beforeEach(() => {
wodget = new Wodget();
menu = new FileMenu({ commands });
tracker = new InstanceTracker({ namespace: 'wodget' });
void tracker.add(wodget);
});