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


TypeScript ApiChains.cAssertContent方法代码示例

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


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

示例1: Theme

UnitTest.asynctest('browser.tinymce.plugins.autosave.ShouldRestoreWhenEmptyTest', (success, failure) => {
  Theme();
  Plugin();

  const cAssertHasDraft = (expected: boolean) => Chain.op((editor: Editor) => {
    RawAssertions.assertEq(`should${!expected ? 'n\'t' : ''} have draft`, expected, editor.plugins.autosave.hasDraft());
  });

  const cStoreDraft = Chain.op((editor: Editor) => {
    editor.plugins.autosave.storeDraft();
  });

  const cRemoveDraft = Chain.op((editor: Editor) => {
    editor.plugins.autosave.removeDraft();
  });

  const cAddUndoLevel = Chain.op((editor: Editor) => {
    editor.undoManager.add();
  });

  const testingPrefix = Math.random().toString(36).substring(7);
  Pipeline.async({}, [
    Logger.t('should restore draft when empty with setting', Chain.asStep({}, [
      McEditor.cFromSettings({ skin_url: '/project/js/tinymce/skins/lightgray', plugins: 'autosave', autosave_prefix: testingPrefix }),
      cAssertHasDraft(false),
      ApiChains.cSetContent('<p>X</p>'),
      cAddUndoLevel,
      cStoreDraft,
      cAssertHasDraft(true),
      McEditor.cRemove,
      McEditor.cFromSettings({ autosave_restore_when_empty: true, skin_url: '/project/js/tinymce/skins/lightgray', plugins: 'autosave', autosave_prefix: testingPrefix }),
      cAssertHasDraft(true),
      ApiChains.cAssertContent('<p>X</p>'),
      cRemoveDraft,
      McEditor.cRemove
    ])),
    Logger.t('shouldn\'t restore draft when empty without setting', Chain.asStep({}, [
      McEditor.cFromSettings({ skin_url: '/project/js/tinymce/skins/lightgray', plugins: 'autosave', autosave_prefix: testingPrefix }),
      cAssertHasDraft(false),
      ApiChains.cSetContent('<p>X</p>'),
      cAddUndoLevel,
      cStoreDraft,
      cAssertHasDraft(true),
      McEditor.cRemove,
      McEditor.cFromSettings({ skin_url: '/project/js/tinymce/skins/lightgray', plugins: 'autosave', autosave_prefix: testingPrefix }),
      cAssertHasDraft(true),
      ApiChains.cAssertContent(''),
      cRemoveDraft,
      McEditor.cRemove
    ]))
  ], () => success(), failure);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:52,代码来源:ShouldRestoreWhenEmptyTest.ts

示例2: ModernTheme

UnitTest.asynctest('browser.tinymce.core.content.EditorContentWsTest', (success, failure) => {
  ModernTheme();

  Pipeline.async({}, [
    Logger.t('Editor initialized on pre element should retain whitespace on get/set content', Chain.asStep({}, [
      Editor.cFromHtml('<pre>  a  </pre>', {
        inline: true,
        skin_url: '/project/js/tinymce/skins/lightgray'
      }),
      ApiChains.cAssertContent('  a  '),
      ApiChains.cSetContent('  b  '),
      ApiChains.cAssertContent('  b  '),
      Editor.cRemove
    ]))
  ], function () {
    success();
  }, failure);
});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:18,代码来源:EditorContentWsTest.ts

示例3: function

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

  Theme();

  const settings = {
    skin_url: '/project/js/tinymce/skins/lightgray',
    inline: true
  };

  Pipeline.async({}, [
    Logger.t('Pressing shift+enter in brMode inside a h1 should insert a br', Chain.asStep({}, [
      Editor.cFromHtml('<h1>ab</h1>', Merger.merge(settings, { forced_root_block: false })),
      ApiChains.cFocus,
      ApiChains.cSetCursor([0], 1),
      ActionChains.cContentKeystroke(Keys.enter(), { shift: true }),
      ApiChains.cAssertContent('a<br />b'),
      Editor.cRemove
    ]))
  ], function () {
    success();
  }, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:24,代码来源:EnterKeyInlineTest.ts


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