当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript widgets.Widget类代码示例

本文整理汇总了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();
 });
开发者ID:SylvainCorlay,项目名称:jupyterlab,代码行数:9,代码来源:default-toolbar.spec.ts

示例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();
 });
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:9,代码来源:manager.spec.ts

示例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);
 });
开发者ID:alexmorley,项目名称:jupyterlab,代码行数:9,代码来源:toolbar.spec.ts

示例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();
 });
开发者ID:afshin,项目名称:jupyterlab,代码行数:9,代码来源:inputarea.spec.ts

示例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();
 });
开发者ID:groutr,项目名称:jupyterlab,代码行数:9,代码来源:default-toolbar.spec.ts

示例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();
 });
开发者ID:samvasko,项目名称:jupyterlab,代码行数:9,代码来源:default-toolbar.spec.ts

示例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;
  }
开发者ID:SylvainCorlay,项目名称:jupyterlab,代码行数:43,代码来源:index.ts

示例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();
   });
 });
开发者ID:vidartf,项目名称:nbdime,代码行数:10,代码来源:flexpanel.spec.ts

示例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);
 });
开发者ID:willingc,项目名称:jupyterlab,代码行数:10,代码来源:default-toolbar.spec.ts


注:本文中的@phosphor/widgets.Widget类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。