當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。