|
@@ -1,7 +1,6 @@
|
|
|
// Copyright (c) Jupyter Development Team.
|
|
|
-// Distributed under the terms of the Modified BSD License.
|
|
|
|
|
|
-import { expect } from 'chai';
|
|
|
+import 'jest';
|
|
|
|
|
|
import { find, ArrayExt } from '@lumino/algorithm';
|
|
|
|
|
@@ -41,7 +40,7 @@ describe('@jupyterlab/mainmenu', () => {
|
|
|
describe('#constructor()', () => {
|
|
|
it('should construct a new main menu', () => {
|
|
|
const menu = new MainMenu(new CommandRegistry());
|
|
|
- expect(menu).to.be.an.instanceof(MainMenu);
|
|
|
+ expect(menu).toBeInstanceOf(MainMenu);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -49,9 +48,7 @@ describe('@jupyterlab/mainmenu', () => {
|
|
|
it('should add a new menu', () => {
|
|
|
const menu = new Menu({ commands });
|
|
|
mainMenu.addMenu(menu);
|
|
|
- expect(find(mainMenu.menus, m => menu === m) !== undefined).to.equal(
|
|
|
- true
|
|
|
- );
|
|
|
+ expect(find(mainMenu.menus, m => menu === m) !== undefined).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should take a rank as an option', () => {
|
|
@@ -59,104 +56,104 @@ describe('@jupyterlab/mainmenu', () => {
|
|
|
const menu2 = new Menu({ commands });
|
|
|
mainMenu.addMenu(menu1, { rank: 300 });
|
|
|
mainMenu.addMenu(menu2, { rank: 200 });
|
|
|
- expect(ArrayExt.firstIndexOf(mainMenu.menus, menu1)).to.equal(6);
|
|
|
- expect(ArrayExt.firstIndexOf(mainMenu.menus, menu2)).to.equal(5);
|
|
|
+ expect(ArrayExt.firstIndexOf(mainMenu.menus, menu1)).toBe(6);
|
|
|
+ expect(ArrayExt.firstIndexOf(mainMenu.menus, menu2)).toBe(5);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#fileMenu', () => {
|
|
|
it('should be a FileMenu', () => {
|
|
|
- expect(mainMenu.fileMenu).to.be.an.instanceof(FileMenu);
|
|
|
+ expect(mainMenu.fileMenu).toBeInstanceOf(FileMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the first menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.fileMenu.menu)
|
|
|
- ).to.equal(0);
|
|
|
+ ).toBe(0);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#editMenu', () => {
|
|
|
it('should be a EditMenu', () => {
|
|
|
- expect(mainMenu.editMenu).to.be.an.instanceof(EditMenu);
|
|
|
+ expect(mainMenu.editMenu).toBeInstanceOf(EditMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the second menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.editMenu.menu)
|
|
|
- ).to.equal(1);
|
|
|
+ ).toBe(1);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#viewMenu', () => {
|
|
|
it('should be a ViewMenu', () => {
|
|
|
- expect(mainMenu.viewMenu).to.be.an.instanceof(ViewMenu);
|
|
|
+ expect(mainMenu.viewMenu).toBeInstanceOf(ViewMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the third menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.viewMenu.menu)
|
|
|
- ).to.equal(2);
|
|
|
+ ).toBe(2);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#runMenu', () => {
|
|
|
it('should be a RunMenu', () => {
|
|
|
- expect(mainMenu.runMenu).to.be.an.instanceof(RunMenu);
|
|
|
+ expect(mainMenu.runMenu).toBeInstanceOf(RunMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the fourth menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.runMenu.menu)
|
|
|
- ).to.equal(3);
|
|
|
+ ).toBe(3);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#kernelMenu', () => {
|
|
|
it('should be a KernelMenu', () => {
|
|
|
- expect(mainMenu.kernelMenu).to.be.an.instanceof(KernelMenu);
|
|
|
+ expect(mainMenu.kernelMenu).toBeInstanceOf(KernelMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the fifth menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.kernelMenu.menu)
|
|
|
- ).to.equal(4);
|
|
|
+ ).toBe(4);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#tabsMenu', () => {
|
|
|
it('should be a TabsMenu', () => {
|
|
|
- expect(mainMenu.tabsMenu).to.be.an.instanceof(TabsMenu);
|
|
|
+ expect(mainMenu.tabsMenu).toBeInstanceOf(TabsMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the sixth menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.tabsMenu.menu)
|
|
|
- ).to.equal(5);
|
|
|
+ ).toBe(5);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#settingsMenu', () => {
|
|
|
it('should be a SettingsMenu', () => {
|
|
|
- expect(mainMenu.settingsMenu).to.be.an.instanceof(SettingsMenu);
|
|
|
+ expect(mainMenu.settingsMenu).toBeInstanceOf(SettingsMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the seventh menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.settingsMenu.menu)
|
|
|
- ).to.equal(6);
|
|
|
+ ).toBe(6);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#helpMenu', () => {
|
|
|
it('should be a HelpMenu', () => {
|
|
|
- expect(mainMenu.helpMenu).to.be.an.instanceof(HelpMenu);
|
|
|
+ expect(mainMenu.helpMenu).toBeInstanceOf(HelpMenu);
|
|
|
});
|
|
|
|
|
|
it('should be the eighth menu', () => {
|
|
|
expect(
|
|
|
ArrayExt.firstIndexOf(mainMenu.menus, mainMenu.helpMenu.menu)
|
|
|
- ).to.equal(7);
|
|
|
+ ).toBe(7);
|
|
|
});
|
|
|
});
|
|
|
});
|