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


TypeScript agar.Step类代码示例

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


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

示例1: function

 const sSetContent = function (editor, content, args) {
   return Step.sync(function () {
     SetSelectionContent.setContent(editor, content, args);
   });
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:5,代码来源:SetSelectionContentTest.ts

示例2: TestExtras

UnitTest.asynctest('WindowManager:inline-dialog Test', (success, failure) => {
  const helpers = TestExtras();
  const windowManager = WindowManager.setup(helpers.extras);

  const store = TestHelpers.TestStore();

  const currentApi = Cell<Types.Dialog.DialogInstanceApi<any>>({ } as any);

  const sTestOpen = (params) => Chain.asStep({ }, [
    Chain.mapper((_) => {
      const dialogSpec: Types.Dialog.DialogApi<{ fred: string }> = {
        title: 'Silver Test Inline (Toolbar) Dialog',
        body: {
          type: 'panel',
          items: [
            {
              type: 'input',
              name: 'fred',
              label: 'Freds Input'
            },
          ]
        },
        buttons: [
          {
            type: 'custom',
            name: 'barny',
            text: 'Barny Text',
            align: 'start',
            primary: true
          },
        ],
        initialData: {
          fred: 'said hello pebbles'
        },
        onSubmit: store.adder('onSubmit'),
        onClose: store.adder('onClose'),
        onCancel: store.adder('onCancel'),
        onChange: store.adder('onChange'),
        onAction: store.adder('onAction')
      };
      return windowManager.open(dialogSpec, params, store.adder('closeWindow'));
    }),

    Chain.op((dialogApi) => {
      Assertions.assertEq('Initial data', {
        fred: 'said hello pebbles'
      }, dialogApi.getData());

      currentApi.set(dialogApi);
    })
  ]);

  const sTestClose = GeneralSteps.sequence([
    Mouse.sClickOn(Body.body(), '[aria-label="Close"]'),
    UiFinder.sNotExists(Body.body(), '[role="dialog"]')
  ]);

  Pipeline.async({}, [
    TestHelpers.GuiSetup.mAddStyles(Element.fromDom(document), [
      '.tox-dialog { background: white; border: 2px solid black; padding: 1em; margin: 1em; }'
    ]),
    sTestOpen({ inline: 'magic' }),
    FocusTools.sTryOnSelector(
      'Focus should start on the input',
      Element.fromDom(document),
      'input'
    ),
    Step.sync(() => {
      currentApi.get().disable('barny');
    }),
    sTestClose,
    Waiter.sTryUntil(
      'Waiting for all dialog events when closing',
      store.sAssertEq('Checking stuff', [
        'onCancel',
        'closeWindow',
        'onClose'
      ]),
      100,
      3000
    ),

    store.sClear,

    sTestOpen({ inline: 'toolbar' }),
    FocusTools.sTryOnSelector(
      'Focus should start on the input',
      Element.fromDom(document),
      'input'
    ),
    Assertions.sAssertStructure('"tox-dialog__scroll-disable" should not have been added to the body',
      ApproxStructure.build((s, str, arr) => {
        return s.element('body', {
          classes: [ arr.not('tox-dialog__disable-scroll') ]
        });
      }),
      Body.body()
    ),
    Step.sync(() => {
      helpers.uiMothership.broadcastOn([ Channels.dismissPopups() ], {
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:SilverInlineDialogTest.ts

示例3:

const sAnnotate = (editor: Editor, name: string, uid: string, data: { }) => Step.sync(() => {
  editor.annotator.annotate(name, {
    uid,
    ...data
  });
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:6,代码来源:AnnotationAsserts.ts

示例4: function

 const sDelete = function (editor) {
   return Step.sync(function () {
     DeleteCommands.deleteCommand(editor);
   });
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:5,代码来源:DeleteCommandsTest.ts

示例5: function

 const sWaitForResizeHandles = function (editor) {
   return Waiter.sTryUntil('Wait for new width value', Step.sync(function () {
     RawAssertions.assertEq('Resize handle should exist', editor.dom.select('#mceResizeHandlenw').length, 1);
   }), 1, 3000);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:5,代码来源:ReopenResizeTest.ts

示例6: function

 const sAssertScrollPosition = function (editor: Editor, x: number, y: number) {
   return Step.sync(function () {
     Assertions.assertEq('Scroll position X should be expected value', x, Math.round(editor.dom.getViewPort(editor.getWin()).x));
     Assertions.assertEq('Scroll position Y should be expected value', y, Math.round(editor.dom.getViewPort(editor.getWin()).y));
   });
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:6,代码来源:ScrollIntoViewTest.ts

示例7:

 const sOpen = (toolbarKey: string) => Step.sync(() => {
   editor.fire('contexttoolbar-show', {
     toolbarKey
   });
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:5,代码来源:ContextFormTest.ts

示例8: function

 const sAssertNormalizeCounter = function (expected) {
   return Step.sync(function () {
     Assertions.assertEq('checking normalization counter', expected, count);
   });
 };
开发者ID:abstask,项目名称:tinymce,代码行数:5,代码来源:SelectionQuirksTest.ts

示例9: function

 const sNormalizeBody = function (editor) {
   return Step.sync(function () {
     editor.getBody().normalize();
   });
 };
开发者ID:abstask,项目名称:tinymce,代码行数:5,代码来源:InlineBoundaryDeleteTest.ts

示例10: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyActions = TinyActions(editor);
    let count;

    // hijack editor.selection.normalize() to count how many times it will be invoked
    const backupNormalize = editor.selection.normalize;
    const normalize = function () {
      count = count === undefined ? 1 : count + 1;
      backupNormalize.apply(this, arguments);
    };
    editor.selection.normalize = normalize;

    const sResetNormalizeCounter = function () {
      return Step.sync(function () {
        count = 0;
      });
    };

    const sAssertNormalizeCounter = function (expected) {
      return Step.sync(function () {
        Assertions.assertEq('checking normalization counter', expected, count);
      });
    };

    const sClickBody = function (editor) {
      return Step.sync(function () {
        const target = editor.getBody();

        editor.fire('mousedown', { target });
        editor.fire('mouseup', { target });
        editor.fire('click', { target });
      });
    };

    Pipeline.async({}, [
      tinyApis.sFocus,

      Logger.t('Test normalization for floated images', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a<img src="about:blank" style="float: right"></p>'),
        tinyApis.sSetSelection([0], 1, [0], 2),
        Step.sync(function () {
          const selection = editor.selection.getSel();
          Assertions.assertEq('Anchor node should be the paragraph not the text node', 'P', selection.anchorNode.nodeName);
          Assertions.assertEq('Anchor offset should be the element index', 1, selection.anchorOffset);
        })
      ])),

      Logger.t('Normalize on key events when range is collapsed', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p><p>b</p>'),
        tinyApis.sSetSelection([], 1, [], 1),
        tinyActions.sContentKeystroke(Keys.escape(), {}),
        tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
      ])),

      Logger.t('Normalize on mouse events when range is expanded', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p><p>b</p>'),
        tinyApis.sSetSelection([], 0, [], 1),
        sClickBody(editor),
        tinyApis.sAssertSelection([0, 0], 0, [0, 0], 1)
      ])),

      Logger.t('Normalize on mouse events when range is collapsed', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p><p>b</p>'),
        tinyApis.sSetSelection([], 1, [], 1),
        sClickBody(editor),
        tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
      ])),

      Logger.t('Normalization during operations with modifier keys, should run only once in the end when user releases modifier key.', GeneralSteps.sequence([
        sResetNormalizeCounter(),
        tinyApis.sSetContent('<p><b>a</b><i>a</i></p>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 0], 0),
        Keyboard.sKeyup(Element.fromDom(editor.getDoc()), Keys.left(), { shift: true }),
        sAssertNormalizeCounter(0),
        Keyboard.sKeyup(Element.fromDom(editor.getDoc()), 17, {}), // single ctrl
        sAssertNormalizeCounter(1),
        tinyApis.sAssertSelection([0, 0], 0, [0, 0], 0)
      ]))
    ], onSuccess, onFailure);
  }, {
开发者ID:abstask,项目名称:tinymce,代码行数:81,代码来源:SelectionQuirksTest.ts


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