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


TypeScript Pipeline.async方法代码示例

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


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

示例1: Theme

UnitTest.asynctest('Editor (Silver) directionality test', (success, failure) => {
  Theme();

  EditorManager.addI18n('ar', {
    Bold: 'Bold test',
    _dir: 'rtl'
  });

  const cGetEditorContainer = Chain.mapper((editor: Editor) => Element.fromDom(editor.getContainer()));

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

  const makeStep = (config, label, editorStructure) => {
    return Chain.asStep({}, [
      McEditor.cFromSettings(config),
      NamedChain.asChain([
        NamedChain.direct(NamedChain.inputName(), Chain.identity, 'editor'),
        NamedChain.direct('editor', cSetContent('<p>Hello world!</p>'), ''),
        NamedChain.direct('editor', cGetEditorContainer, 'editorContainer'),
        NamedChain.direct('editorContainer', Assertions.cAssertStructure(
          label,
          editorStructure
        ), 'assertion'),
        NamedChain.output('editor')
      ]),
      McEditor.cRemove
    ]);
  };

  Pipeline.async({}, [
    Log.step('TBA', 'Test directionality of the editor UI when set to use a rtl language', makeStep(
      {
        theme: 'silver',
        language: 'ar',
        base_url: '/project/tinymce/js/tinymce'
      },
      'Directionality of the editor UI should be `rtl` when using a rtl language',
      ApproxStructure.build((s, str, arr) => {
        return s.element('div', {
          classes: [ arr.has('tox-tinymce') ],
          attrs: { dir: str.is('rtl') }
        });
      })
    )),

    Log.step('TBA', 'Test directionality of the editor UI when set to use a language without directionality', makeStep(
      {
        theme: 'silver',
        language: 'en',
        base_url: '/project/tinymce/js/tinymce'
      },
      'Directionality of the editor UI should not be set when using a language without directionality',
      ApproxStructure.build((s, str, arr) => {
        return s.element('div', {
          classes: [ arr.has('tox-tinymce') ],
          attrs: { dir: str.none() }
        });
      })
    ))
  ], success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:63,代码来源:SilverEditorDirectionalityTest.ts

示例2: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const inlineFormat = [{ inline: 'b' }];
    const blockFormat = [{ block: 'div' }];
    const selectorFormat = [{ selector: 'div', classes: 'b' }];
    const selectorFormatCollapsed = [{ selector: 'div', classes: 'b', collapsed: true }];

    Pipeline.async({}, [
      tinyApis.sFocus,
      Logger.t('Expand inline format words', GeneralSteps.sequence([
        Logger.t('In middle of single word in paragraph', Chain.asStep(editor, [
          cSetRawContent('<p>ab</p>'),
          cExpandRng([0, 0], 1, [0, 0], 1, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('In middle of single word in paragraph with paragraph siblings', Chain.asStep(editor, [
          cSetRawContent('<p>a</p><p>bc</p><p>de</p>'),
          cExpandRng([1, 0], 1, [1, 0], 1, inlineFormat, false),
          cAssertRange(editor, [], 1, [], 2)
        ])),
        Logger.t('In middle of single word wrapped in b', Chain.asStep(editor, [
          cSetRawContent('<p><b>ab</b></p>'),
          cExpandRng([0, 0, 0], 1, [0, 0, 0], 1, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('In middle of first word', Chain.asStep(editor, [
          cSetRawContent('<p>ab cd</p>'),
          cExpandRng([0, 0], 1, [0, 0], 1, inlineFormat, false),
          cAssertRange(editor, [], 0, [0, 0], 2)
        ])),
        Logger.t('In middle of last word', Chain.asStep(editor, [
          cSetRawContent('<p>ab cd</p>'),
          cExpandRng([0, 0], 4, [0, 0], 4, inlineFormat, false),
          cAssertRange(editor, [0, 0], 3, [], 1)
        ])),
        Logger.t('In middle of middle word', Chain.asStep(editor, [
          cSetRawContent('<p>ab cd ef</p>'),
          cExpandRng([0, 0], 4, [0, 0], 4, inlineFormat, false),
          cAssertRange(editor, [0, 0], 3, [0, 0], 5)
        ])),
        Logger.t('In middle of word with bold siblings expand to sibling spaces', Chain.asStep(editor, [
          cSetRawContent('<p><b>ab </b>cd<b> ef</b></p>'),
          cExpandRng([0, 1], 1, [0, 1], 1, inlineFormat, false),
          cAssertRange(editor, [0, 0, 0], 3, [0, 2, 0], 0)
        ])),
        Logger.t('In middle of word with block sibling and inline sibling expand to sibling space to the right', Chain.asStep(editor, [
          cSetRawContent('<div><p>ab </p>cd<b> ef</b></div>'),
          cExpandRng([0, 1], 1, [0, 1], 1, inlineFormat, false),
          cAssertRange(editor, [0, 1], 0, [0, 2, 0], 0)
        ])),
        Logger.t('In middle of word with block sibling and inline sibling expand to sibling space to the left', Chain.asStep(editor, [
          cSetRawContent('<div><b>ab </b>cd<p> ef</p></div>'),
          cExpandRng([0, 1], 1, [0, 1], 1, inlineFormat, false),
          cAssertRange(editor, [0, 0, 0], 3, [0, 1], 2)
        ])),
        Logger.t('In middle of middle word separated by nbsp characters', Chain.asStep(editor, [
          cSetRawContent('<p>ab\u00a0cd\u00a0ef</p>'),
          cExpandRng([0, 0], 4, [0, 0], 4, inlineFormat, false),
          cAssertRange(editor, [0, 0], 3, [0, 0], 5)
        ])),
        Logger.t('In empty paragraph', Chain.asStep(editor, [
          cSetRawContent('<p><br></p>'),
          cExpandRng([0], 0, [0], 0, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('Fully selected word', Chain.asStep(editor, [
          cSetRawContent('<p>ab</p>'),
          cExpandRng([0, 0], 0, [0, 0], 2, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('Partially selected word', Chain.asStep(editor, [
          cSetRawContent('<p>abc</p>'),
          cExpandRng([0, 0], 1, [0, 0], 2, inlineFormat, false),
          cAssertRange(editor, [0, 0], 1, [0, 0], 2)
        ])),
        Logger.t('Whole word selected wrapped in multiple inlines', Chain.asStep(editor, [
          cSetRawContent('<p><b><i>c</i></b></p>'),
          cExpandRng([0, 0, 0, 0], 0, [0, 0, 0, 0], 1, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('Whole word inside td', Chain.asStep(editor, [
          cSetRawContent('<table><tbody><tr><td>a</td></tr></tbody></table>'),
          cExpandRng([0, 0, 0, 0, 0], 0, [0, 0, 0, 0, 0], 1, inlineFormat, false),
          cAssertRange(editor, [0, 0, 0], 0, [0, 0, 0], 1)
        ])),
        Logger.t('In middle of single word in paragraph (index based)', Chain.asStep(editor, [
          cSetRawContent('<p>ab</p>'),
          cExpandRng([0], 0, [0], 1, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('In middle of single word wrapped in bold in paragraph (index based)', Chain.asStep(editor, [
          cSetRawContent('<p><b>ab</b></p>'),
          cExpandRng([0], 0, [0], 1, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ])),
        Logger.t('In middle of word inside bookmark then exclude bookmark', Chain.asStep(editor, [
          cSetRawContent('<p><span data-mce-type="bookmark">ab cd ef</span></p>'),
          cExpandRng([0, 0, 0], 3, [0, 0, 0], 5, inlineFormat, false),
          cAssertRange(editor, [], 0, [], 1)
        ]))
//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:ExpandRangeTest.ts

示例3: function

UnitTest.asynctest('browser.tinymce.core.CaretContainerRemoveTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const viewBlock = ViewBlock();

  if (!Env.ceFalse) {
    return;
  }

  const getRoot = function () {
    return viewBlock.get();
  };

  const setupHtml = function (html) {
    viewBlock.update(html);
  };

  const sTestRemove = Logger.t(
    'Remove',
    Step.sync(function () {
      setupHtml('<span contentEditable="false">1</span>');

      CaretContainer.insertInline(getRoot().firstChild, true);
      Assertions.assertEq('Should be inline container', true, CaretContainer.isCaretContainerInline(getRoot().firstChild));

      CaretContainerRemove.remove(getRoot().firstChild);
      Assertions.assertEq('Should not be inline container', false, CaretContainer.isCaretContainerInline(getRoot().firstChild));
    })
  );

  const sTestRemoveAndRepositionBlockAtOffset = Logger.t(
    'removeAndReposition block in same parent at offset',
    Step.sync(function () {
      setupHtml('<span contentEditable="false">1</span>');

      CaretContainer.insertBlock('p', getRoot().firstChild, true);
      Assertions.assertEq('Should be block container', true, CaretContainer.isCaretContainerBlock(getRoot().firstChild));

      const pos = CaretContainerRemove.removeAndReposition(getRoot().firstChild, new CaretPosition(getRoot(), 0));
      Assertions.assertEq('Should be unchanged offset', 0, pos.offset());
      Assertions.assertDomEq('Should be unchanged container', Element.fromDom(getRoot()), Element.fromDom(pos.container()));
      Assertions.assertEq('Should not be block container', false, CaretContainer.isCaretContainerBlock(getRoot().firstChild));
    })
  );

  const sTestRemoveAndRepositionBeforeOffset = Logger.t(
    'removeAndReposition block in same parent before offset',
    Step.sync(function () {
      setupHtml('<span contentEditable="false">1</span><span contentEditable="false">2</span>');

      CaretContainer.insertBlock('p', getRoot().childNodes[1], true);
      Assertions.assertEq('Should be block container', true, CaretContainer.isCaretContainerBlock(getRoot().childNodes[1]));

      const pos = CaretContainerRemove.removeAndReposition(getRoot().childNodes[1], new CaretPosition(getRoot(), 0));
      Assertions.assertEq('Should be unchanged offset', 0, pos.offset());
      Assertions.assertDomEq('Should be unchanged container', Element.fromDom(getRoot()), Element.fromDom(pos.container()));
      Assertions.assertEq('Should not be block container', false, CaretContainer.isCaretContainerBlock(getRoot().childNodes[1]));
    })
  );

  const sTestRemoveAndRepositionAfterOffset = Logger.t(
    'removeAndReposition block in same parent after offset',
    Step.sync(function () {
      setupHtml('<span contentEditable="false">1</span><span contentEditable="false">2</span>');

      CaretContainer.insertBlock('p', getRoot().childNodes[1], true);
      Assertions.assertEq('Should be block container', true, CaretContainer.isCaretContainerBlock(getRoot().childNodes[1]));

      const pos = CaretContainerRemove.removeAndReposition(getRoot().childNodes[1], new CaretPosition(getRoot(), 3));
      Assertions.assertEq('Should be changed offset', 2, pos.offset());
      Assertions.assertDomEq('Should be unchanged container', Element.fromDom(getRoot()), Element.fromDom(pos.container()));
      Assertions.assertEq('Should not be block container', false, CaretContainer.isCaretContainerBlock(getRoot().childNodes[1]));
    })
  );

  viewBlock.attach();
  Pipeline.async({}, [
    sTestRemove,
    sTestRemoveAndRepositionBlockAtOffset,
    sTestRemoveAndRepositionBeforeOffset,
    sTestRemoveAndRepositionAfterOffset
  ], function () {
    viewBlock.detach();
    success();
  }, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:86,代码来源:CaretContainerRemoveTest.ts

示例4: TinyApis

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

    Pipeline.async({}, [
      Logger.t('Insert key in text with in nbsp text node', GeneralSteps.sequence([
        Logger.t('Nbsp at first character position', GeneralSteps.sequence([
          Logger.t('Insert in text node with nbsp at start of body', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('&nbsp;a'),
            tinyApis.sSetCursor([0], 2),
            sFireInsert(editor),
            tinyApis.sAssertSelection([0], 2, [0], 2),
            tinyApis.sAssertContent('&nbsp;a')
          ])),
          Logger.t('Insert in text in node with leading nbsp after inline with trailing space', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a<em>b </em>&nbsp;c'),
            tinyApis.sSetCursor([2], 2),
            sFireInsert(editor),
            tinyApis.sAssertSelection([2], 2, [2], 2),
            tinyApis.sAssertContent('a<em>b </em>&nbsp;c')
          ])),
          Logger.t('Insert in text in node with leading nbsp after inline', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a<em>b</em>&nbsp;c'),
            tinyApis.sSetCursor([2], 2),
            sFireInsert(editor),
            tinyApis.sAssertSelection([2], 2, [2], 2),
            tinyApis.sAssertContent('a<em>b</em> c')
          ])),
          Logger.t('Insert in text in node with leading nbsp after inline with trailing nbsp', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a<em>b&nbsp;</em>&nbsp;c'),
            tinyApis.sSetCursor([2], 2),
            sFireInsert(editor),
            tinyApis.sAssertSelection([2], 2, [2], 2),
            tinyApis.sAssertContent('a<em>b&nbsp;</em> c')
          ])),
          Logger.t('Insert at beginning of text node with leading nbsp after a br', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a<br />&nbsp;b'),
            tinyApis.sSetCursor([2], 0),
            sFireInsert(editor),
            tinyApis.sAssertSelection([2], 0, [2], 0),
            tinyApis.sAssertContent('a<br />&nbsp;b')
          ])),
          Logger.t('Insert at beginning of text node with leading nbsp within inline element followed by br', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a<br /><em>&nbsp;b</em>'),
            tinyApis.sSetCursor([2, 0], 0),
            sFireInsert(editor),
            tinyApis.sAssertSelection([2, 0], 0, [2, 0], 0),
            tinyApis.sAssertContent('a<br /><em>&nbsp;b</em>')
          ]))
        ])),

        Logger.t('Nbsp at last character position', GeneralSteps.sequence([
          Logger.t('Insert in text node with nbsp at end of body', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a&nbsp;'),
            tinyApis.sSetCursor([0], 0),
            sFireInsert(editor),
            tinyApis.sAssertSelection([0], 0, [0], 0),
            tinyApis.sAssertContent('a&nbsp;')
          ])),
          Logger.t('Insert in text in node with leading nbsp after inline with trailing space', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a&nbsp;<em> b</em>c'),
            tinyApis.sSetCursor([0], 0),
            sFireInsert(editor),
            tinyApis.sAssertSelection([0], 0, [0], 0),
            tinyApis.sAssertContent('a&nbsp;<em> b</em>c')
          ])),
          Logger.t('Insert in text in node with trailing nbsp before inline', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a&nbsp;<em>b</em>c'),
            tinyApis.sSetCursor([0], 0),
            sFireInsert(editor),
            tinyApis.sAssertSelection([0], 0, [0], 0),
            tinyApis.sAssertContent('a <em>b</em>c')
          ])),
          Logger.t('Insert in text in node with trailing nbsp before inline with leading nbsp', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a&nbsp;<em>&nbsp;b</em>c'),
            tinyApis.sSetCursor([0], 0),
            sFireInsert(editor),
            tinyApis.sAssertSelection([0], 0, [0], 0),
            tinyApis.sAssertContent('a <em>&nbsp;b</em>c')
          ])),
          Logger.t('Insert in text in node with single middle nbsp', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a&nbsp;b'),
            tinyApis.sSetCursor([0], 3),
            sFireInsert(editor),
            tinyApis.sAssertSelection([0], 3, [0], 3),
            tinyApis.sAssertContent('a b')
          ])),
          Logger.t('Insert in text in node with multiple middle nbsp', GeneralSteps.sequence([
            tinyApis.sFocus,
            tinyApis.sSetRawContent('a&nbsp;b&nbsp;c&nbsp;d'),
//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:InsertKeysBrModeTest.ts

示例5:

 TinyLoader.setup(function (editor, onSuccess, onFailure) {
   Pipeline.async({}, Log.steps('TBA', 'SearchReplace: Find and replace matches', suite.toSteps(editor)), onSuccess, onFailure);
 }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:SearchReplacePluginTest.ts

示例6: TinyApis

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

    Pipeline.async({}, [
      Logger.t('Enter inside inline boundary link', GeneralSteps.sequence([
        Logger.t('Insert br at beginning of inline boundary link', GeneralSteps.sequence([
          tinyApis.sFocus,
          tinyApis.sSetContent('<p>a<a href="#">b</a>c</p>'),
          tinyApis.sSetCursor([0, 1, 0], 0),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0, 2, 0], 1, [0, 2, 0], 1),
          tinyApis.sAssertContent('<p>a<br /><a href="#">b</a>c</p>')
        ])),
        Logger.t('Insert br in middle inline boundary link', GeneralSteps.sequence([
          tinyApis.sFocus,
          tinyApis.sSetContent('<p>a<a href="#">bc</a>d</p>'),
          tinyApis.sSetCursor([0, 1, 0], 1),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0, 1], 2, [0, 1], 2),
          tinyApis.sAssertContent('<p>a<a href="#">b<br />c</a>d</p>')
        ])),
        Logger.t('Insert br at end of inline boundary link', GeneralSteps.sequence([
          tinyApis.sFocus,
          tinyApis.sSetContent('<p>a<a href="#">b</a>c</p>'),
          tinyApis.sSetCursor([0, 1, 0], 1),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0], 3, [0], 3),
          tinyApis.sAssertContent('<p>a<a href="#">b</a><br /><br />c</p>')
        ])),
        Logger.t('Insert br at end of inline boundary link with trailing br', GeneralSteps.sequence([
          tinyApis.sFocus,
          sSetRawContent(editor, '<p>a<a href="#">b</a><br /></p>'),
          tinyApis.sSetCursor([0, 1, 0], 1),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0], 3, [0], 3),
          tinyApis.sAssertContent('<p>a<a href="#">b</a><br /><br /></p>')
        ]))
      ])),
      Logger.t('Enter inside inline boundary code', GeneralSteps.sequence([
        Logger.t('Insert br at beginning of boundary code', GeneralSteps.sequence([
          tinyApis.sFocus,
          tinyApis.sSetContent('<p>a<code>b</code>c</p>'),
          tinyApis.sSetCursor([0, 1, 0], 0),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0, 1], 2, [0, 1], 2),
          tinyApis.sAssertContent('<p>a<code><br />b</code>c</p>')
        ])),
        Logger.t('Insert br at middle of boundary code', GeneralSteps.sequence([
          tinyApis.sFocus,
          tinyApis.sSetContent('<p>a<code>bc</code>d</p>'),
          tinyApis.sSetCursor([0, 1, 0], 1),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0, 1], 2, [0, 1], 2),
          tinyApis.sAssertContent('<p>a<code>b<br />c</code>d</p>')
        ])),
        Logger.t('Insert br at end of boundary code', GeneralSteps.sequence([
          tinyApis.sFocus,
          tinyApis.sSetContent('<p>a<code>b</code>c</p>'),
          tinyApis.sSetCursor([0, 1, 0], 1),
          tinyApis.sNodeChanged,
          sInsertBr(editor),
          tinyApis.sAssertSelection([0, 1, 2], 0, [0, 1, 2], 0),
          tinyApis.sAssertContent('<p>a<code>b<br /></code>c</p>')
        ]))
      ]))
    ], onSuccess, onFailure);
  }, {
开发者ID:abstask,项目名称:tinymce,代码行数:73,代码来源:InsertBrTest.ts

示例7: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    Pipeline.async({}, [
      tinyApis.sFocus,

      Logger.t('resize table height by dragging bottom', GeneralSteps.sequence([
        tinyApis.sSetContent('<table style="border-collapse: collapse;border: 0;"><tbody><tr><td style="height:45px;">a</td></tr><tr><td style="height:45px;">a</td></tr></tbody></table>'),
        sSetStateFrom(editor, [0, 0, 0, 0]),
        sWaitForSelection(editor, tinyApis),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-row="0"]', 0, 50),
        sAssertSizeChange(editor, [0, 0, 0, 0], { dh: 50, dw: 0 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('resize table width by dragging right side', GeneralSteps.sequence([
        tinyApis.sSetContent('<table style="border-collapse: collapse;border: 0;"><tbody><tr><td style="height:45px;">a</td></tr><tr><td style="height:45px;">a</td></tr></tbody></table>'),
        sSetStateFrom(editor, [0, 0, 0, 0]),
        sWaitForSelection(editor, tinyApis),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-column="0"]', 50, 0),
        sAssertSizeChange(editor, [0, 0, 0, 0], { dh: 0, dw: 50 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table bigger with handle, then resize row height bigger by dragging middle border', GeneralSteps.sequence([
        tinyApis.sSetContent(tableHtml),
        sSetStateFrom(editor, [0]),
        sWaitForSelection(editor, tinyApis),
        sDragDrop(Element.fromDom(editor.getBody()), '#mceResizeHandlese', 50, 50),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-row="0"]', 0, 50),
        sAssertSizeChange(editor, [0], { dh: 100, dw: 50 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table bigger with handle, then resize row height smaller by dragging middle border', GeneralSteps.sequence([
        tinyApis.sSetContent(tableHtml),
        sSetStateFrom(editor, [0]),
        sWaitForSelection(editor, tinyApis),
        sDragDrop(Element.fromDom(editor.getBody()), '#mceResizeHandlese', 50, 50),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-row="0"]', 0, -30),
        sAssertSizeChange(editor, [0], { dh: 20, dw: 50 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table bigger with handle, then resize column width bigger by dragging middle border', GeneralSteps.sequence([
        tinyApis.sSetContent(tableHtml),
        sSetStateFrom(editor, [0]),
        sWaitForSelection(editor, tinyApis),
        sDragDrop(Element.fromDom(editor.getBody()), '#mceResizeHandlese', 50, 50),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-column="0"]', 50, 0),
        sAssertSizeChange(editor, [0], { dh: 50, dw: 50 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table bigger with handle, then resize column width smaller by dragging middle border', GeneralSteps.sequence([
        tinyApis.sSetContent(tableHtml),
        sSetStateFrom(editor, [0]),
        sWaitForSelection(editor, tinyApis),
        sDragDrop(Element.fromDom(editor.getBody()), '#mceResizeHandlese', 50, 50),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-column="0"]', -30, 0),
        sAssertSizeChange(editor, [0], { dh: 50, dw: 50 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table smaller with handle, then resize row height bigger by dragging middle border', GeneralSteps.sequence([
        tinyApis.sSetContent(tableHtml),
        sSetStateFrom(editor, [0]),
        sWaitForSelection(editor, tinyApis),
        sDragDrop(Element.fromDom(editor.getBody()), '#mceResizeHandlese', -10, -10),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-row="0"]', 0, 50),
        sAssertSizeChange(editor, [0], { dh: 40, dw: -10 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table smaller with handle, then resize row height smaller by dragging middle border', GeneralSteps.sequence([
        tinyApis.sSetContent(tableHtml),
        sSetStateFrom(editor, [0]),
        sWaitForSelection(editor, tinyApis),
        sDragDrop(Element.fromDom(editor.getBody()), '#mceResizeHandlese', -10, -10),
        sMouseover(Element.fromDom(editor.getBody()), 'td'),
        sDragDropBlocker(Element.fromDom(editor.getDoc().documentElement), 'div[data-row="0"]', 0, -20),
        sAssertSizeChange(editor, [0], { dh: -30, dw: -10 }),
        sAssertNoDataStyle(editor, [0]),
        sResetState
      ])),

      Logger.t('Resize table smaller with handle, then resize column width bigger by dragging middle border', GeneralSteps.sequence([
//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:DragResizeTest.ts

示例8: function

UnitTest.asynctest('browser.tinymce.core.html.EntitiesTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const suite = LegacyUnit.createSuite();

  suite.test('encodeRaw', function () {
    LegacyUnit.equal(
      Entities.encodeRaw('<>"\'&\u00e5\u00e4\u00f6\u0060'),
      '&lt;&gt;"\'&amp;\u00e5\u00e4\u00f6\u0060',
      'Raw encoding text'
    );
    LegacyUnit.equal(
      Entities.encodeRaw('<>"\'&\u00e5\u00e4\u00f6\u0060', true),
      '&lt;&gt;&quot;\'&amp;\u00e5\u00e4\u00f6&#96;',
      'Raw encoding attribute'
    );
  });

  suite.test('encodeAllRaw', function () {
    LegacyUnit.equal(Entities.encodeAllRaw('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;&quot;&#39;&amp;\u00e5\u00e4\u00f6', 'Raw encoding all');
  });

  suite.test('encodeNumeric', function () {
    LegacyUnit.equal(
      Entities.encodeNumeric('<>"\'&\u00e5\u00e4\u00f6\u03b8\u2170\ufa11'),
      '&lt;&gt;"\'&amp;&#229;&#228;&#246;&#952;&#8560;&#64017;',
      'Numeric encoding text'
    );
    LegacyUnit.equal(
      Entities.encodeNumeric('<>"\'&\u00e5\u00e4\u00f6', true),
      '&lt;&gt;&quot;\'&amp;&#229;&#228;&#246;',
      'Numeric encoding attribute'
    );
  });

  suite.test('encodeNamed', function () {
    LegacyUnit.equal(Entities.encodeNamed('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&auml;&ouml;', 'Named encoding text');
    LegacyUnit.equal(
      Entities.encodeNamed('<>"\'&\u00e5\u00e4\u00f6', true),
      '&lt;&gt;&quot;\'&amp;&aring;&auml;&ouml;',
      'Named encoding attribute'
    );
    LegacyUnit.equal(
      Entities.encodeNamed('<>"\'\u00e5\u00e4\u00f6', false, { ĂĽ: '&aring;' }),
      '&lt;&gt;"\'&aring;\u00e4\u00f6',
      'Named encoding text'
    );
    LegacyUnit.equal(
      Entities.encodeNamed('<>"\'\u00e5\u00e4\u00f6', true, { ĂĽ: '&aring;' }),
      '&lt;&gt;&quot;\'&aring;\u00e4\u00f6',
      'Named encoding attribute'
    );
  });

  suite.test('getEncodeFunc', function () {
    let encodeFunc;

    encodeFunc = Entities.getEncodeFunc('raw');
    LegacyUnit.equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;\u00e5\u00e4\u00f6', 'Raw encoding text');
    LegacyUnit.equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;\u00e5\u00e4\u00f6', 'Raw encoding attribute');
    LegacyUnit.equal(encodeFunc('\ud87e\udc04'), '\ud87e\udc04', 'Raw high-byte encoding text');
    LegacyUnit.equal(encodeFunc('\ud87e\udc04', true), '\ud87e\udc04', 'Raw high-byte encoding attribute');

    encodeFunc = Entities.getEncodeFunc('named');
    LegacyUnit.equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&auml;&ouml;', 'Named encoding text');
    LegacyUnit.equal(
      encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true),
      '&lt;&gt;&quot;\'&amp;&aring;&auml;&ouml;',
      'Named encoding attribute'
    );
    LegacyUnit.equal(encodeFunc('\ud87e\udc04'), '\ud87e\udc04', 'Named high-byte encoding text');
    LegacyUnit.equal(encodeFunc('\ud87e\udc04', true), '\ud87e\udc04', 'Named high-byte encoding attribute');

    encodeFunc = Entities.getEncodeFunc('numeric');
    LegacyUnit.equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&#229;&#228;&#246;', 'Numeric encoding text');
    LegacyUnit.equal(
      encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true),
      '&lt;&gt;&quot;\'&amp;&#229;&#228;&#246;',
      'Numeric encoding attribute');
    LegacyUnit.equal(encodeFunc('\ud87e\udc04'), '&#194564;', 'Numeric high-byte encoding text');
    LegacyUnit.equal(encodeFunc('\ud87e\udc04', true), '&#194564;', 'Numeric high-byte encoding attribute');

    encodeFunc = Entities.getEncodeFunc('named+numeric', '229,aring');
    LegacyUnit.equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&#228;&#246;', 'Named+numeric encoding text');
    LegacyUnit.equal(
      encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true),
      '&lt;&gt;&quot;\'&amp;&aring;&#228;&#246;',
      'Named+numeric encoding attribute'
    );
    LegacyUnit.equal(encodeFunc('\ud87e\udc04'), '&#194564;', 'Named+numeric high-byte encoding text');
    LegacyUnit.equal(encodeFunc('\ud87e\udc04', true), '&#194564;', 'Named+numeric high-byte encoding attribute');

    encodeFunc = Entities.getEncodeFunc('named,numeric', '229,aring');
    LegacyUnit.equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&#228;&#246;', 'Named+numeric encoding text');
    LegacyUnit.equal(
      encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true),
      '&lt;&gt;&quot;\'&amp;&aring;&#228;&#246;',
      'Named+numeric encoding attribute'
    );
    LegacyUnit.equal(encodeFunc('\ud87e\udc04'), '&#194564;', 'Named+numeric high-byte encoding text');
//.........这里部分代码省略.........
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:101,代码来源:EntitiesTest.ts

示例9: function

UnitTest.asynctest('browser.tinymce.core.html.WriterTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];
  const suite = LegacyUnit.createSuite();

  suite.test('Comment', function () {
    let writer;

    writer = Writer();
    writer.comment('text');
    LegacyUnit.equal(writer.getContent(), '<!--text-->');

    writer = Writer();
    writer.comment('');
    LegacyUnit.equal(writer.getContent(), '<!---->');
  });

  suite.test('CDATA', function () {
    let writer;

    writer = Writer();
    writer.cdata('text');
    LegacyUnit.equal(writer.getContent(), '<![CDATA[text]]>');

    writer = Writer();
    writer.cdata('');
    LegacyUnit.equal(writer.getContent(), '<![CDATA[]]>');
  });

  suite.test('PI', function () {
    let writer;

    writer = Writer();
    writer.pi('xml', 'someval');
    LegacyUnit.equal(writer.getContent(), '<?xml someval?>');

    writer = Writer();
    writer.pi('xml');
    LegacyUnit.equal(writer.getContent(), '<?xml?>');

    writer = Writer();
    writer.pi('xml', 'encoding="UTF-8" < >');
    LegacyUnit.equal(writer.getContent(), '<?xml encoding="UTF-8" &lt; &gt;?>');
  });

  suite.test('Doctype', function () {
    let writer;

    writer = Writer();
    writer.doctype(' text');
    LegacyUnit.equal(writer.getContent(), '<!DOCTYPE text>');

    writer = Writer();
    writer.doctype('');
    LegacyUnit.equal(writer.getContent(), '<!DOCTYPE>');
  });

  suite.test('Text', function () {
    let writer;

    writer = Writer();
    writer.text('te<xt');
    LegacyUnit.equal(writer.getContent(), 'te&lt;xt');

    writer = Writer();
    writer.text('');
    LegacyUnit.equal(writer.getContent(), '');
  });

  suite.test('Text raw', function () {
    let writer;

    writer = Writer();
    writer.text('te<xt', true);
    LegacyUnit.equal(writer.getContent(), 'te<xt');

    writer = Writer();
    writer.text('', true);
    LegacyUnit.equal(writer.getContent(), '');
  });

  suite.test('Start', function () {
    let writer;

    writer = Writer();
    writer.start('b');
    LegacyUnit.equal(writer.getContent(), '<b>');

    writer = Writer();
    writer.start('b', [{ name: 'attr1', value: 'value1' }, { name: 'attr2', value: 'value2' }]);
    LegacyUnit.equal(writer.getContent(), '<b attr1="value1" attr2="value2">');

    writer = Writer();
    writer.start('b', [{ name: 'attr1', value: 'val<"ue1' }]);
    LegacyUnit.equal(writer.getContent(), '<b attr1="val&lt;&quot;ue1">');

    writer = Writer();
    writer.start('img', [{ name: 'attr1', value: 'value1' }, { name: 'attr2', value: 'value2' }], true);
    LegacyUnit.equal(writer.getContent(), '<img attr1="value1" attr2="value2" />');

//.........这里部分代码省略.........
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:101,代码来源:WriterTest.ts

示例10: Plugin

UnitTest.asynctest('browser.tinymce.plugins.importcss.ImportCssGroupsTest', (success, failure) => {

  Plugin();
  Theme();

  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);
  });

  Pipeline.async({ }, [

    Log.step(
      'TBA',
      'importcss: content_css with three files, append false, groups with overall selector converter',
      sTestEditorWithSettings(
        {
          navigation: [
            { item: 'Other', subitems: [ 'h1.red.DDD', 'p.other.DDD', 'span.inline.DDD' ] },
            { item: 'Advanced', subitems: [ 'h2.advanced.CCC', 'h3.advanced.CCC', 'h4.advanced.CCC' ] }
          ],
          choice: {
            keysBeforeExecute: [ Keys.right() ],
            presence: 'span.converted'
          }
        },
        {
          content_css: [
            '/project/tinymce/src/plugins/importcss/test/css/basic.css',
            '/project/tinymce/src/plugins/importcss/test/css/advanced.css',
            '/project/tinymce/src/plugins/importcss/test/css/other-adv.css'
          ],
          importcss_append: false,
          importcss_groups: [
            { title: 'Advanced', filter: /.adv/, custom: '.CCC' },
            { title: 'Other', custom: '.DDD' }
          ],

          importcss_selector_converter: (selector, group) => {
            return {
              title: selector + group.custom,
              classes: [ 'converted' ],
              inline: 'span'
            };
          }
        }
      )
    ),

    Log.step(
      'TBA',
      'importcss: content_css with three files, append false, groups with group selector converters',
      sTestEditorWithSettings(
        {
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:ImportCssGroupsPluginTest.ts


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