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


TypeScript Chain.wait方法代码示例

本文整理汇总了TypeScript中@ephox/agar.Chain.wait方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Chain.wait方法的具体用法?TypeScript Chain.wait怎么用?TypeScript Chain.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/agar.Chain的用法示例。


在下文中一共展示了Chain.wait方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

 const sOpenContextMenu = (target) => {
   return Chain.asStep(editor, [
     tinyUi.cTriggerContextMenu('trigger image context menu', target, '.tox-silver-sink [role="menuitem"]'),
     // Not sure why this is needed, but without the browser deselects the contextmenu target
     Chain.wait(0)
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:ContextMenuTest.ts

示例2: TinyUi

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyUi = TinyUi(editor);
    const tinyApis = TinyApis(editor);

    Pipeline.async({}, [
      tinyApis.sFocus,
      Log.stepsAsStep('TBA', 'Media: test cached response', [
        tinyUi.sClickOnToolbar('click media button', 'button[aria-label="Insert/edit media"]'),
        Chain.asStep({}, [
          Chain.fromParent(
            tinyUi.cWaitForPopup('wait for media dialog', 'div[role="dialog"]'), [
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'test'),
                Utils.cFakeEvent('paste'),
                Chain.wait(0) // wait is needed because paste is triggered async
              ]),
              Chain.runStepsOnValue(() => [ Utils.sAssertEmbedData(tinyUi, '<div>x</div>') ]),
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'XXX')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn(Utils.selectors.saveButton),
                Mouse.cClick
              ])
            ]
          )
        ]),

        sWaitForAndAssertNotification('<p>Media embed handler threw unknown error.</p>'),
        tinyApis.sAssertContent('')
      ])
    ], onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:33,代码来源:IsCachedResponseTest.ts

示例3: cFindInDialog

const sSetValueAndTrigger = (selector, value, events: string[]) => (ui) => {
  return Logger.t(`Set ${value} and trigger ${events.join(',')}`, Chain.asStep({}, [
    Chain.fromChains([
      cFindInDialog(selector)(ui),      // get the element
      Chain.op(Focus.focus),            // fire focusin, required by sizeinput to recalc ratios
      cSetValueOn(selector, value)(ui), // change the value
      ...Arr.map(events, (event) => cFakeEvent(event)),                 // fire [change, input etc],
      Chain.wait(0) // Wait needed as paste event is triggered async
    ])
  ]));
};
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:Utils.ts

示例4: function

  const cExecCommandFromDialog = function (label) {
    let cInteractWithUi;

    switch (label) {
      case 'Rotate counterclockwise':
      case 'Rotate clockwise':
      case 'Flip vertically':
      case 'Flip horizontally':
        // Orientation operations, like Flip or Rotate are grouped in a sub-panel
        cInteractWithUi = cClickToolbarButton(label);
        label = 'Orientation';
        break;

      case 'Brightness':
      case 'Contrast':
      case 'Color levels':
      case 'Gamma':
        cInteractWithUi = cDragDrop;
        break;

      default:
        cInteractWithUi = Chain.wait(1);
    }

    return Chain.control(
      Chain.fromChains([
        cClickToolbarButton('Edit image'),
        Chain.fromParent(ui.cWaitForPopup('wait for Edit Image dialog', '[role="dialog"]'), [
          ui.cWaitForUi('wait for canvas', '.tox-image-tools__image > img'),
          Chain.wait(200),
          cClickToolbarButton(label),
          cInteractWithUi,
          Chain.wait(200),
          cClickButton('Apply'),
          cClickButton('Save'),
          cWaitForDialogClose()
        ])
      ]),
      Guard.addLogging(`Execute ${label} command from dialog`)
    );
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:41,代码来源:ImageOps.ts

示例5: cClickContextToolbarButton

 const cGetImageSources = (label) => {
   return NamedChain.asChain(
     [
       NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
       Chain.label('Store img src before flip', NamedChain.write('srcBeforeFlip', cGetImageSrc)),
       Chain.label('Flip image', NamedChain.read('editor', cClickContextToolbarButton(label))),
       // Wait for image to flip
       Chain.wait(500),
       Chain.label('Store img src after flip', NamedChain.write('srcAfterFlip', cGetImageSrc)),
       NamedChain.merge(['srcBeforeFlip', 'srcAfterFlip'], 'urls'),
       NamedChain.output('urls')
     ]
   );
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:14,代码来源:ContextToolbarTest.ts

示例6: cSetContent

 const makeStep = (config, structureLabel, editorStructure) => {
   return Chain.asStep({}, [
     Editor.cFromSettings(config),
     NamedChain.asChain([
       NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
       NamedChain.direct('editor', cSetContent('<p><strong>hello world</strong></p>'), ''),
       NamedChain.direct('editor', Chain.wait(300), ''),
       NamedChain.direct('editor', cGetContainer, 'editorContainer'),
       NamedChain.direct('editorContainer', Assertions.cAssertStructure(
         structureLabel,
         editorStructure
       ), 'assertion'),
       NamedChain.output('editor'),
     ]),
     Editor.cRemove
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:17,代码来源:StatusbarTest.ts

示例7: function

  const cExecCommandFromDialog = function (label) {
    let cInteractWithUi;

    switch (label) {
      case 'Rotate counterclockwise':
      case 'Rotate clockwise':
      case 'Flip vertically':
      case 'Flip horizontally':
        // Orientation operations, like Flip or Rotate are grouped in a sub-panel
        cInteractWithUi = cClickToolbarButton(label);
        label = 'Orientation';
        break;

      case 'Brightness':
      case 'Contrast':
      case 'Color levels':
      case 'Gamma':
        cInteractWithUi = cDragSlider;
        break;

      default:
        cInteractWithUi = Chain.wait(1);
    }

    return Chain.fromChains([
      cClickToolbarButton('Edit image'),
      Chain.fromParent(ui.cWaitForPopup('wait for Edit Image dialog', 'div[aria-label="Edit image"][role="dialog"]'), [
        ui.cWaitForUi('wait for canvas', '.mce-imagepanel > img'),
        cClickToolbarButton(label),
        Chain.fromParent(cWaitForChain(cFindChildWithState('.mce-container.mce-form', Visibility.isVisible)), [
          Chain.fromChains([
            cInteractWithUi
          ]),
          cClickButton('Apply')
        ]),
        ui.cWaitForUi('wait for Save button to become enabled', 'div[role="button"]:contains(Save):not(.mce-disabled)'),
        cClickButton('Save')
      ])
    ]);
  };
开发者ID:abstask,项目名称:tinymce,代码行数:40,代码来源:ImageOps.ts

示例8: Theme

UnitTest.asynctest('Statusbar Structure Test', (success, failure) => {

  Theme();
  Wordcount();

  const fullStatusbarSpec = (s, str, arr) => {
    return [
      s.element('div', {
        classes: [ arr.has('tox-statusbar__text-container')],
        children: [
          s.element('div', {
            classes: [ arr.has('tox-statusbar__path')],
            children: [
              s.element('div', { children: [ s.text(str.is('p')) ] }),
              s.element('div', { children: [ s.text(str.is(' » ')) ] }),
              s.element('div', { children: [ s.text(str.is('strong')) ] })
            ]
          }),
          s.element('button', {
            classes: [ arr.has('tox-statusbar__wordcount')],
            children: [ s.text(str.is('2 words')) ]
          }),
          s.element('span', {
            classes: [ arr.has('tox-statusbar__branding')],
            children: [
              s.element('a', { children: [ s.text(str.is('Powered by Tiny')) ] })
            ]
          }),
        ]
      }),
      s.element('div', {
        classes: [ arr.has('tox-statusbar__resize-handle')],
      })
    ];
  };

  const statusbarWithoutWordcountSpec = (s, str, arr) => {
    return [
      s.element('div', {
        classes: [ arr.has('tox-statusbar__text-container')],
        children: [
          s.element('div', {
            classes: [ arr.has('tox-statusbar__path')],
            children: [
              s.element('div', { children: [ s.text(str.is('p')) ] }),
              s.element('div', { children: [ s.text(str.is(' » ')) ] }),
              s.element('div', { children: [ s.text(str.is('strong')) ] })
            ]
          }),
          s.element('span', {
            classes: [ arr.has('tox-statusbar__branding')],
            children: [
              s.element('a', { children: [ s.text(str.is('Powered by Tiny')) ] })
            ]
          }),
        ]
      }),
      s.element('div', {
        classes: [ arr.has('tox-statusbar__resize-handle')],
      })
    ];
  };

  const statusbarWithoutResizeSpec = (s, str, arr) => {
    return [
      s.element('div', {
        classes: [ arr.has('tox-statusbar__text-container')],
        children: [
          s.element('div', {
            classes: [ arr.has('tox-statusbar__path')],
            children: [
              s.element('div', { children: [ s.text(str.is('p')) ] }),
              s.element('div', { children: [ s.text(str.is(' » ')) ] }),
              s.element('div', { children: [ s.text(str.is('strong')) ] })
            ]
          }),
          s.element('span', {
            classes: [ arr.has('tox-statusbar__branding')],
            children: [
              s.element('a', { children: [ s.text(str.is('Powered by Tiny')) ] })
            ]
          })
        ]
      })
    ];
  };

  const cGetContainer = Chain.mapper((editor: any) => Element.fromDom(editor.editorContainer));

  const cSetContent = (content: string) => Chain.mapper(function (editor: any) {
    return editor.editorCommands.execCommand('mceSetContent', false, content);
  });

  const makeStep = (config, structureLabel, editorStructure) => {
    return Chain.asStep({}, [
      Editor.cFromSettings(config),
      NamedChain.asChain([
        NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
        NamedChain.direct('editor', cSetContent('<p><strong>hello world</strong></p>'), ''),
        NamedChain.direct('editor', Chain.wait(300), ''),
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:StatusbarTest.ts

示例9:

 const sOpenContextMenu = (target: string) => {
   return Chain.asStep(editor, [
     tinyUi.cTriggerContextMenu('trigger context menu', target, '.tox-silver-sink [role="menuitem"]'),
     Chain.wait(0)
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:6,代码来源:ContextMenuTest.ts


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