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


TypeScript Step.async方法代码示例

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


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

示例1: TinyApis

  const sTestEditorWithSettings = (categories, databaseUrl) => Step.async((onStepSuccess, onStepFailure) => {
    TinyLoader.setup(function (editor, onSuccess, onFailure) {
      const tinyApis = TinyApis(editor);
      const tinyUi = TinyUi(editor);

      Pipeline.async({}, [
          tinyApis.sFocus,
          tinyUi.sClickOnToolbar('click emoticons', 'button'),
          Chain.asStep({}, [
            tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
          ]),
          Waiter.sTryUntil(
            'Wait for emojis to load',
            UiFinder.sNotExists(Body.body(), '.tox-spinner'),
            100,
            1000
          ),
          Chain.asStep(Body.body(), [
            UiFinder.cFindAllIn('[role="tab"]'),
            Chain.mapper((elements: Element[]) => {
              return Arr.map(elements, (elm: Element) => {
                return elm.dom().textContent;
              });
            }),
            Assertions.cAssertEq('Categories match', categories)
          ])
        ], onSuccess, onFailure);
    }, {
      plugins: 'emoticons',
      toolbar: 'emoticons',
      theme: 'silver',
      base_url: '/project/tinymce/js/tinymce',
      emoticons_database_url: databaseUrl
    }, onStepSuccess, onStepFailure);
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:35,代码来源:DifferentEmojiDatabaseTest.ts

示例2: function

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

  ModernTheme();

  Pipeline.async({}, [
    Logger.t(
      'firefox specific test, boxutils should not throw error when used on hidden iframe',
      Step.async(function (next, die) {
        const iframe = document.createElement('iframe');
        iframe.style.display = 'none';
        document.body.appendChild(iframe);

        iframe.addEventListener('load', function () {
          try {
            const measured = BoxUtils.measureBox(iframe.contentDocument.body.firstChild, 'border');
            Assertions.assertEq('should return 0', 0, measured.top);
            iframe.parentNode.removeChild(iframe);
            next();
          } catch (e) {
            die('Should not throw error, ' + e.message);
          }
        }, false);

        iframe.contentDocument.open();
        iframe.contentDocument.write('<html><body><div>a</div></body></html>');
        iframe.contentDocument.close();
      })
    )
  ], function () {
    success();
  }, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:34,代码来源:BoxUtilsMeasureBoxIframeDisplayNoneTest.ts

示例3: function

  const sBlobToBase64 = function () {
    return Step.async(function (next) {
      const base64 = 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
      const blob = base64ToBlob(base64, 'image/gif');

      Conversions.blobToBase64(blob).then(function (convertedBase64) {
        Assertions.assertEq('Not the correct base64', base64, convertedBase64);
        next();
      });
    });
  };
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:ConversionsTest.ts

示例4: next

  const shouldFail = (label, conf, asserter) => {
    return Step.async(function (next, die) {
      try {
        windowManager.open(conf, {}, Fun.noop);
      } catch (err) {
        asserter(err);
        return next();
      }

      die('This should throw a configuration error: ' + label);
    });
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:12,代码来源:WindowManagerTest.ts

示例5: function

  const sCreateInlineEditors = function (html) {
    return Step.async(function (done) {
      viewBlock.update(html);

      EditorManager.init({
        selector: '.tinymce',
        inline: true,
        skin_url: '/project/js/tinymce/skins/lightgray'
      }).then(function () {
        done();
      });
    });
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:13,代码来源:CefFocusTest.ts

示例6: function

const sLoadImage = function (editor, url, size?) {
  return Step.async(function (done) {
    const img = new Image();

    img.onload = function () {
      editor.setContent(`<p><img src="${url}" ${size ? `width="${size.width}" height="${size.height}"` : ''} /></p>`);
      editor.focus();
      done();
    };

    img.src = url;
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:ImageUtils.ts

示例7: function

const sLoadImage = function (editor, url) {
  return Step.async(function (done) {
    const img = new Image();

    img.onload = function () {
      editor.setContent('<p><img src="' + url + '" /></p>');
      editor.focus();
      done();
    };

    img.src = url;
  });
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:13,代码来源:ImageUtils.ts

示例8: TinyUi

  const sTestEditorWithSettings = (assertions, pluginSettings) => Step.async((onStepSuccess, onStepFailure) => {
    TinyLoader.setup((editor, onSuccess, onFailure) => {
      const doc = Element.fromDom(document);

      const tinyUi = TinyUi(editor);

      const sOpenStyleMenu = GeneralSteps.sequence([
        tinyUi.sClickOnToolbar('Clicking on the styleselect dropdown', 'button')
      ]);

      const navigationSteps = MenuNavigationTestUtils.generateNavigation(doc, assertions.navigation);

      Pipeline.async({}, Arr.flatten([
        [
          Assertions.sAssertPresence(
            `${assertions.choice.presence} should NOT be present`,
            {
              [assertions.choice.presence]: 0
            },
            Element.fromDom(editor.getBody())
          )
        ],
        [ sOpenStyleMenu ],
        navigationSteps,
        Arr.map(assertions.choice.keysBeforeExecute, (k) => Keyboard.sKeydown(doc, k, { })),
        [ Keyboard.sKeydown(doc, Keys.enter(), { }) ],
        [
          Assertions.sAssertPresence(
            `${assertions.choice.presence} should now be present`,
            {
              [assertions.choice.presence]: 1
            },
            Element.fromDom(editor.getBody())
          )
        ]
      ]), onSuccess, onFailure);
    }, {
      plugins: 'importcss',
      toolbar: 'styleselect',
      theme: 'silver',
      content_css: pluginSettings.content_css,
      importcss_append: pluginSettings.importcss_append,
      importcss_selector_filter: pluginSettings.importcss_selector_filter,
      importcss_file_filter: pluginSettings.importcss_file_filter,
      importcss_groups: pluginSettings.importcss_groups,
      importcss_selector_converter: pluginSettings.importcss_selector_converter,
      importcss_exclusive: pluginSettings.importcss_exclusive,
      base_url: '/project/tinymce/js/tinymce'
    }, () => onStepSuccess(), onStepFailure);
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:50,代码来源:ImportCssGroupsPluginTest.ts

示例9: function

  const sExec = function (execFromToolbar, label) {
    return Logger.t(`Execute ${label}`, Step.async(function (next, die) {
      const imgEl = TinyDom.fromDom(editor.selection.getNode());
      const origUrl = Attr.get(imgEl, 'src');

      Pipeline.async({}, [
        Chain.asStep(imgEl, [
          Mouse.cClick,
          ui.cWaitForPopup('wait for Imagetools toolbar', '.tox-pop__dialog div'),
          execFromToolbar ? cClickToolbarButton(label) : cExecCommandFromDialog(label)
        ]),
        sWaitForUrlChange(imgEl, origUrl)
      ], function () {
        next();
      }, die);
    }));
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:17,代码来源:ImageOps.ts

示例10: function

  const sExec = function (execFromToolbar, label) {
    return Step.async(function (next, die) {
      const imgEl = TinyDom.fromDom(editor.selection.getNode());
      const origUrl = Attr.get(imgEl, 'src');

      Pipeline.async({}, [
        Chain.asStep(imgEl, [
          Mouse.cClick,
          ui.cWaitForPopup('wait for Imagetools toolbar', 'div[aria-label="Inline toolbar"][role="dialog"]'),
          execFromToolbar ? cClickToolbarButton(label) : cExecCommandFromDialog(label)
        ]),
        sWaitForUrlChange(imgEl, origUrl)
      ], function () {
        next();
      }, die);
    });
  };
开发者ID:abstask,项目名称:tinymce,代码行数:17,代码来源:ImageOps.ts


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