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