當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。