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


TypeScript Guard.tryUntil方法代码示例

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


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

示例1: TinyUi

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

    Pipeline.async({}, [
      Log.stepsAsStep('TBA', 'Image: image proportion constrains should work directly', [
        tinyUi.sClickOnToolbar('click image button', 'button[aria-label="Insert/edit image"]'),
        Chain.asStep({}, [
          Chain.fromParent(tinyUi.cWaitForPopup('Wait for dialog', 'div[role="dialog"]'),
            [
              Chain.fromChains([
                UiFinder.cFindIn('button.tox-browse-url'),
                Mouse.cClick
              ]),
              Chain.control(
                cAssertInputValue(generalTabSelectors.width, '1'),
                Guard.tryUntil('did not find width input with value 1', 10, 1000)
              ),
              cSetInputValue(generalTabSelectors.height, '5'),
              Chain.control(
                cAssertInputValue(generalTabSelectors.width, '5'),
                Guard.tryUntil('did not find width input with value 5', 10, 1000)
              ),
            ]
          ),
          tinyUi.cSubmitDialog(),
          Chain.inject(editor),
          cAssertCleanHtml('Checking output', '<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="" width="5" height="5" /></p>')
        ])
      ])

    ], onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:32,代码来源:ImageResizeTest.ts

示例2:

  const cWaitForContextmenuState = (state: boolean) => Chain.control(
    Chain.op(() => {
      const contextToolbar = UiFinder.findIn(Body.body(), '.tox-pop');

      Assertions.assertEq('no context toolbar', state, contextToolbar.isValue());
    }),
    Guard.tryUntil('Wait for context menu to appear.', 100, 3000)
  );
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:RemoveContextMenuOnFocusoutTest.ts

示例3: function

 Obj.each(data, function (data, label) {
   chains.push(
     cFireFakePasteEvent(data),
     Chain.control(
       cAssertEditorContent(label, expected),
       Guard.tryUntil('Wait for paste to succeed.', 100, 1000)
     ),
     cClearEditor()
   );
 });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:10,代码来源:PlainTextPasteTest.ts

示例4:

const cFindInDialog = (selector) => Chain.control(
  Chain.fromChains([
    Chain.inject(TinyDom.fromDom(document.body)),
    Chain.control(
      UiFinder.cFindIn('[role="dialog"]'),
      Guard.tryUntil('Waiting for dialog', 100, 1000)
    ),
    UiFinder.cFindIn(selector)
  ]),
  Guard.addLogging('Find in dialog')
);
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:TestLinkUi.ts

示例5: function

const assertStructureInDialog = function (errString, objStruc, waitOn, clickOn) {
    return Logger.t('Assert structure in dialog', Chain.asStep(TinyDom.fromDom(document.body), [
      UiFinder.cWaitFor('Could not find notification', waitOn),
      Mouse.cClickOn(clickOn),
      Chain.control(
        Chain.op((panel) => {
          Assertions.assertPresence(errString, objStruc, panel);
        }),
        Guard.tryUntil('Keep waiting', 100, 4000)
      )
    ]));
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:12,代码来源:PluginAssert.ts

示例6: function

 const cAssertEmbedValue = function (expected) {
   return Chain.control(
     Chain.fromChains([
       UiFinder.cFindIn('label:contains("Paste your embed code below:")'),
       Chain.mapper(function (elm) {
         return TinyDom.fromDom(document.getElementById(elm.dom().htmlFor));
       }),
       UiControls.cGetValue,
       Assertions.cAssertHtml('has expected html', expected)
     ]),
     Guard.tryUntil('did not get correct html', 10, 3000)
   );
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:IsCachedResponseTest.ts

示例7:

 const sAssertButtonToggledState = (name: string, state: boolean) => {
   return Chain.asStep(Body.body(), [
     Chain.control(
       Chain.fromChains( [
         UiFinder.cFindIn(`.tox-toolbar button[aria-label="${name}"]`),
         Assertions.cAssertStructure(`Check ${name} button is ${state ? 'active' : 'inactive'}`,
           ApproxStructure.build((s, str, arr) => {
             return s.element('button', {
               classes: [ state ? arr.has('tox-tbtn--enabled') : arr.not('tox-tbtn--enabled') ]
             });
           })
         )
       ]),
       Guard.tryUntil('wait for toolbar button state', 100, 1000)
     )
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:17,代码来源:SelectionToolbarTest.ts

示例8: function

 const cDragHandle = function (id, deltaH, deltaV) {
   return NamedChain.asChain([
     NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
     NamedChain.direct('editor', cGetBody, 'editorBody'),
     NamedChain.read('editorBody', Chain.control(
       UiFinder.cFindIn('#mceResizeHandle' + id),
       Guard.tryUntil('wait for resize handlers', 100, 40000)
     )),
     NamedChain.read('editorBody', Chain.fromChains([
       UiFinder.cFindIn('#mceResizeHandle' + id),
       Mouse.cMouseDown,
       Mouse.cMouseMoveTo(deltaH, deltaV),
       Mouse.cMouseUp
     ])),
     NamedChain.outputInput
   ]);
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:17,代码来源:ResizeTableTest.ts

示例9: TinyUi

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

    Pipeline.async({}, [
      Logger.t('image proportion constrains should work directly', GeneralSteps.sequence([
        tinyUi.sClickOnToolbar('click image button', 'div[aria-label="Insert/edit image"] button'),
        Chain.asStep({}, [
          Chain.fromParent(tinyUi.cWaitForPopup('Wait for dialog', 'div[role="dialog"]'),
            [
              Chain.fromChains([
                UiFinder.cFindIn('i.mce-i-browse'),
                Mouse.cClick
              ]),
              Chain.fromChains([
                Chain.control(
                  Chain.fromChains([
                    UiFinder.cFindIn('input[aria-label="Width"]'),
                    UiControls.cGetValue,
                    Assertions.cAssertEq('should be 1', '1')
                  ]),
                  Guard.tryUntil('did not find input with value 1', 10, 3000)
                )
              ]),
              Chain.fromChains([
                UiFinder.cFindIn('input[aria-label="Height"]'),
                UiControls.cSetValue('5'),
                cFakeEvent('change')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn('input[aria-label="Width"]'),
                UiControls.cGetValue,
                Assertions.cAssertEq('should have changed to 5', '5')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn('div.mce-primary button'),
                Mouse.cClick
              ])
            ]
          )
        ])
      ]))

    ], onSuccess, onFailure);
  }, {
开发者ID:abstask,项目名称:tinymce,代码行数:44,代码来源:ImageResizeTest.ts

示例10: function

UnitTest.asynctest('browser.tinymce.plugins.image.FigureResizeTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  ModernTheme();
  ImagePlugin();

  const cGetBody = Chain.mapper(function (editor) {
    return TinyDom.fromDom(editor.getBody());
  });

  const cGetElementSize = Chain.mapper(function (elm) {
    const elmStyle = elm.dom().style;
    return { w: elmStyle.width, h: elmStyle.height };
  });

  const cDragHandleRight = function (px) {
    return Chain.op(function (input) {
      const dom = input.editor.dom;
      const target = input.resizeSE.dom();
      const pos = dom.getPos(target);

      dom.fire(target, 'mousedown', { screenX: pos.x, screenY: pos.y });
      dom.fire(target, 'mousemove', { screenX: pos.x + px, screenY: pos.y });
      dom.fire(target, 'mouseup');
    });
  };

  Pipeline.async({}, [
    Chain.asStep({}, [
      Editor.cFromSettings({
        plugins: 'image',
        toolbar: 'image',
        indent: false,
        image_caption: true,
        height: 400,
        skin_url: '/project/js/tinymce/skins/lightgray'
      }),
      UiChains.cClickOnToolbar('click image button', 'div[aria-label="Insert/edit image"]'),
      UiChains.cFillActiveDialog({
        src: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
        width: 100,
        height: 100,
        caption: true
      }),
      UiChains.cSubmitDialog(),
      NamedChain.asChain([
        NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
        NamedChain.direct('editor', cGetBody, 'editorBody'),
        // click the image, but expect the handles on the figure
        NamedChain.direct('editorBody', UiFinder.cFindIn('figure > img'), 'img'),
        NamedChain.direct('img', Mouse.cTrueClick, '_'),
        NamedChain.direct(NamedChain.inputName(), ApiChains.cAssertSelection([], 0, [], 1), '_'),
        NamedChain.direct('editorBody', Chain.control(
          UiFinder.cFindIn('#mceResizeHandlese'),
          Guard.tryUntil('wait for resize handlers', 100, 40000)
        ), '_'),
        // actually drag the handle to the right
        NamedChain.direct('editorBody', UiFinder.cFindIn('#mceResizeHandlese'), 'resizeSE'),
        NamedChain.write('_', cDragHandleRight(100)),
        NamedChain.direct('img', cGetElementSize, 'imgSize'),
        NamedChain.direct('imgSize', Assertions.cAssertEq('asserting image size after resize', { w: '200px', h: '200px' }), '_'),
        NamedChain.output('editor')
      ]),
      Editor.cRemove
    ])
  ], function () {
    success();
  }, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:70,代码来源:FigureResizeTest.ts


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