本文整理汇总了TypeScript中@phosphor/widgets.Widget类的典型用法代码示例。如果您正苦于以下问题:TypeScript Widget类的具体用法?TypeScript Widget怎么用?TypeScript Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Widget类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should save when clicked', async () => {
const button = ToolbarItems.createSaveButton(panel);
Widget.attach(button, document.body);
let promise = signalToPromise(context.fileChanged);
await framePromise();
simulate(button.node.firstChild as HTMLElement, 'mousedown');
await promise;
button.dispose();
});
示例2: it
it('should open a file and return the widget used to view it', async () => {
const model = await services.contents.newUntitled({
type: 'file',
ext: '.txt'
});
widget = manager.createNew(model.path);
expect(widget.hasClass('WidgetFactory')).to.equal(true);
await dismissDialog();
});
示例3: it
it("should display the `'display_name'` of the kernel", async () => {
const item = Toolbar.createKernelNameItem(session);
await session.initialize();
Widget.attach(item, document.body);
await framePromise();
expect(
(item.node.firstChild.lastChild as HTMLElement).textContent
).to.equal(session.kernelDisplayName);
});
示例4: it
it('should be called to show the editor', () => {
const widget = new InputArea({ model });
const rendered = new Widget();
Widget.attach(widget, document.body);
widget.renderInput(rendered);
widget.showEditor();
expect(rendered.isAttached).to.equal(false);
widget.dispose();
});
示例5: it
it('should save when clicked', (done) => {
let button = ToolbarItems.createSaveButton(panel);
Widget.attach(button, document.body);
context.fileChanged.connect(() => {
button.dispose();
done();
});
button.node.click();
});
示例6: it
it('should cut when clicked', () => {
let button = ToolbarItems.createCutButton(panel);
let count = panel.notebook.widgets.length;
Widget.attach(button, document.body);
button.node.click();
expect(panel.notebook.widgets.length).to.be(count - 1);
expect(clipboard.hasData(JUPYTER_CELL_MIME)).to.be(true);
button.dispose();
});
示例7: MainMenu
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);
createViewMenu(app, menu.viewMenu);
createTabsMenu(app, menu.tabsMenu);
if (menu.fileMenu.quitEntry) {
palette.addItem({
command: CommandIDs.quit,
category: 'Main Area'
});
}
palette.addItem({
command: CommandIDs.shutdownAllKernels,
category: 'Kernel Operations'
});
palette.addItem({
command: CommandIDs.activatePreviouslyUsedTab,
category: 'Main Area'
});
app.shell.addToTopArea(logo);
app.shell.addToTopArea(menu);
return menu;
}
示例8: it
it('should apply wrap if attached before setting', (done) => {
let p = new FlexPanel();
Widget.attach(p, document.body);
p.wrap = true;
requestAnimationFrame(() => {
expect(p.node.style.flexWrap).to.be('wrap');
p.dispose();
done();
});
});
示例9: it
it("should have the `'jp-AddIcon'` class", async () => {
const button = ToolbarItems.createInsertButton(panel);
Widget.attach(button, document.body);
await framePromise();
expect(
(button.node.firstChild.firstChild as HTMLElement).classList.contains(
'jp-AddIcon'
)
).to.equal(true);
});