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


TypeScript Plugin.default函数代码示例

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


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

示例1: function

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

  Plugin();
  Theme();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const ui = TinyUi(editor);

    Pipeline.async({}, [
      Utils.sTestEmbedContentFromUrl(ui,
        'https://www.youtube.com/watch?v=b3XFjWInBog',
        '<iframe src="//www.youtube.com/embed/b3XFjWInBog" width="560" height="314" allowFullscreen="1"></iframe>'
      ),
      Utils.sTestEmbedContentFromUrl(ui,
        'https://www.google.com',
        '<video width="300" height="150" controls="controls">\n<source src="https://www.google.com" />\n</video>'
      ),
      Utils.sAssertSizeRecalcConstrained(ui),
      Utils.sAssertSizeRecalcUnconstrained(ui),
      Utils.sAssertSizeRecalcConstrainedReopen(ui)
    ], onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:29,代码来源:PluginTest.ts

示例2: function

UnitTest.asynctest('browser.tinymce.plugins.media.IsCachedResponseTest', function (success, failure) {

  Theme();
  MediaPlugin();

  const sWaitForAndAssertNotification = function (expected) {
    return Chain.asStep(TinyDom.fromDom(document.body), [
      UiFinder.cWaitFor('Could not find notification', 'div.tox-notification__body'),
      Chain.mapper(Html.get),
      Assertions.cAssertHtml('Plugin list html does not match', expected)
    ]);
  };

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

    Pipeline.async({}, [
      tinyApis.sFocus,
      Log.stepsAsStep('TBA', 'Media: test cached response', [
        tinyUi.sClickOnToolbar('click media button', 'button[aria-label="Insert/edit media"]'),
        Chain.asStep({}, [
          Chain.fromParent(
            tinyUi.cWaitForPopup('wait for media dialog', 'div[role="dialog"]'), [
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'test'),
                Utils.cFakeEvent('paste'),
                Chain.wait(0) // wait is needed because paste is triggered async
              ]),
              Chain.runStepsOnValue(() => [ Utils.sAssertEmbedData(tinyUi, '<div>x</div>') ]),
              Chain.fromChains([
                Utils.cSetSourceInput(tinyUi, 'XXX')
              ]),
              Chain.fromChains([
                UiFinder.cFindIn(Utils.selectors.saveButton),
                Mouse.cClick
              ])
            ]
          )
        ]),

        sWaitForAndAssertNotification('<p>Media embed handler threw unknown error.</p>'),
        tinyApis.sAssertContent('')
      ])
    ], onSuccess, onFailure);
  }, {
    plugins: 'media',
    toolbar: 'media',
    theme: 'silver',
    base_url: '/project/tinymce/js/tinymce',
    media_url_resolver (data, resolve, reject) {
      if (data.url === 'test') {
        resolve({
          html: '<div>x</div>' });
      } else {
        reject('error');
      }
    }
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:60,代码来源:IsCachedResponseTest.ts

示例3: function

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

  Plugin();
  Theme();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const ui = TinyUi(editor);

    Pipeline.async({}, [
      Utils.sOpenDialog(ui),
      ui.sClickOnUi('Click on close button', 'button:contains("Ok")'),
      Waiter.sTryUntil(
        'Wait for dialog to close',
        UiFinder.sNotExists(TinyDom.fromDom(document.body), 'div[aria-label="Insert/edit media"][role="dialog"]'),
        50, 5000
      )

    ], onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    media_dimensions: false,
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:27,代码来源:DimensionsControlTest.ts

示例4: function

UnitTest.asynctest('browser.tinymce.plugins.media.DimensionsControlTest', function (success, failure) {
  Plugin();
  Theme();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const ui = TinyUi(editor);

    Pipeline.async({}, Log.steps('TBA', 'Media: Open dialog, assert dimensions fields are not present while media_dimensions is false. Close dialog and assert dialog is not present', [
      Utils.sOpenDialog(ui),
      Chain.asStep({}, [
        Chain.fromParent(
          ui.cWaitForPopup('wait for popup', 'div.tox-dialog'),
          [
            Utils.cExists(selectors.source),
            Utils.cNotExists(selectors.width),
            Utils.cNotExists(selectors.height)
          ]
        )
      ]),
      ui.sClickOnUi('Click on close button', 'button:contains("Save")'),
      Waiter.sTryUntil(
        'Wait for dialog to close',
        UiFinder.sNotExists(TinyDom.fromDom(document.body), 'div[aria-label="Insert/edit media"][role="dialog"]'),
        50, 5000
      )
    ])
    , onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    theme: 'silver',
    media_dimensions: false,
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:35,代码来源:DimensionsControlTest.ts

示例5: function

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

  Plugin();
  Theme();

  const struct = ApproxStructure.build(function (s, str) {
    return s.element('body', {
      children: [
        s.element('p', {
          children: [
            s.element('span', {
              attrs: {
                'data-mce-object': str.is('iframe')
              },
              children: [
                s.element('iframe', {
                  attrs: {
                    width: str.is('200'),
                    height: str.is('100')
                  }
                }),
                s.anything()
              ]
            }),
            s.anything()
          ]
        })
      ]
    });
  });

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

    Pipeline.async({}, [
      Utils.sOpenDialog(tinyUi),
      Utils.sPasteTextareaValue(
        tinyUi,
        '<iframe width="200" height="100" src="a" ' +
        ' frameborder="0" allowfullscreen></iframe>'
      ),
      Utils.sSubmitDialog(tinyUi),
      Waiter.sTryUntil(
        'content was not expected structure',
        tinyApis.sAssertContentStructure(struct),
        100,
        4000
      )
    ], onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    media_dimensions: false,
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:59,代码来源:DimensionsFalseEmbedTest.ts

示例6: function

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

  Plugin();
  Theme();

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

  const sRawAssertImagePresence = function (editor) {
    // Hacky way to assert that the placeholder image is in
    // the correct place that works cross browser
    // assertContentStructure did not work because some
    // browsers insert BRs and some do not
    return Step.sync(function () {
      const actualCount = editor.dom.select('img.mce-object').length;
      RawAssertions.assertEq('assert raw content', 1, actualCount);
    });
  };

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const ui = TinyUi(editor);

    Pipeline.async({}, [
      Utils.sOpenDialog(ui),
      Utils.sPasteSourceValue(ui, 'a'),
      Utils.sAssertWidthValue(ui, '300'),
      ui.sClickOnUi('Click on close button', 'button:contains("Ok")'),
      sWaitForResizeHandles(editor),
      Utils.sOpenDialog(ui),
      Utils.sChangeWidthValue(ui, '500'),
      ui.sClickOnUi('Click on close button', 'button:contains("Ok")'),
      sWaitForResizeHandles(editor),
      Waiter.sTryUntil(
        'Try assert content',
        sRawAssertImagePresence(editor),
        100, 3000
      )
    ], onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    indent: false,
    forced_root_block: false,
    skin_url: '/project/js/tinymce/skins/lightgray'
  }, success, failure);
});
开发者ID:abstask,项目名称:tinymce,代码行数:51,代码来源:ReopenResizeTest.ts

示例7: Plugin

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

  Pipeline.async({}, [
    Log.chainsAsStep('TBA', 'Media: if alt source and poster set to false, do not show advance tab', [
      Chain.fromParent(
        Editor.cFromSettings({
          plugins: ['media'],
          toolbar: 'media',
          media_alt_source: false,
          media_poster: false,
          theme: 'silver',
          base_url: '/project/tinymce/js/tinymce'
        }),
        [
          Chain.fromChains([
            UiChains.cClickOnToolbar('click button', 'button[aria-label="Insert/edit media"]'),
            Chain.inject(Body.body()),
            UiFinder.cWaitForVisible('wait for popup', 'div.tox-dialog'),
            Utils.cNotExists('div.tox-tab:contains(Advanced)')
          ]),
          Editor.cRemove
        ]
      )
    ]),
    Log.chainsAsStep('TBA', 'Media: if alt source and poster not set to false, show advance tab', [
      Chain.fromParent(
        Editor.cFromSettings({
          plugins: ['media'],
          toolbar: 'media',
          theme: 'silver',
          base_url: '/project/tinymce/js/tinymce'
        }),
        [
          Chain.fromChains([
            UiChains.cClickOnToolbar('click button', 'button[aria-label="Insert/edit media"]'),
            Chain.inject(Body.body()),
            UiFinder.cWaitForVisible('wait for popup', 'div.tox-dialog'),
            Utils.cExists('div.tox-tab:contains(Advanced)')
          ]),
          Editor.cRemove
        ]
      )
    ])
  ], () => success(), failure);

});
开发者ID:tinymce,项目名称:tinymce,代码行数:48,代码来源:NoAdvancedTabTest.ts

示例8: Plugin

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

  Pipeline.async({}, [
    Logger.t('if alt source and poster set to false, do not show advance tab', Chain.asStep({}, [
      Chain.fromParent(
        Editor.cFromSettings({
          plugins: ['media'],
          toolbar: 'media',
          media_alt_source: false,
          media_poster: false,
          skin_url: '/project/js/tinymce/skins/lightgray'
        }),
        [
          Chain.fromChains([
            UiChains.cClickOnToolbar('click button', 'div[aria-label="Insert/edit media"]'),
            Chain.inject(Body.body()),
            UiFinder.cWaitForVisible('wait for popup', 'div.mce-floatpanel[aria-label="Insert/edit media"]'),
            cNotExists('div.mce-tab:contains("Advanced")')
          ]),
          Editor.cRemove
        ]
      )
    ])),
    Logger.t('if alt source and poster not set to false, show advance tab', Chain.asStep({}, [
      Chain.fromParent(
        Editor.cFromSettings({
          plugins: ['media'],
          toolbar: 'media',
          skin_url: '/project/js/tinymce/skins/lightgray'
        }),
        [
          Chain.fromChains([
            UiChains.cClickOnToolbar('click button', 'div[aria-label="Insert/edit media"]'),
            Chain.inject(Body.body()),
            UiFinder.cWaitForVisible('wait for popup', 'div.mce-floatpanel[aria-label="Insert/edit media"]'),
            cExists('div.mce-tab:contains("Advanced")')
          ]),
          Editor.cRemove
        ]
      )
    ]))
  ], () => success(), failure);

});
开发者ID:danielpunkass,项目名称:tinymce,代码行数:46,代码来源:NoAdvancedTabTest.ts

示例9: function

UnitTest.asynctest('browser.tinymce.plugins.media.MediaPluginSanityTest', function (success, failure) {
  Plugin();
  Theme();

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const ui = TinyUi(editor);
    const apis = TinyApis(editor);

    Pipeline.async({}, [
      Log.stepsAsStep('TBA', 'Media: Embed content, open dialog, set size and assert constrained and unconstrained size recalculation', [apis.sSetContent(''),
        Utils.sTestEmbedContentFromUrl(ui,
          'https://www.youtube.com/watch?v=b3XFjWInBog',
          '<iframe src="//www.youtube.com/embed/b3XFjWInBog" width="560" height="314" allowFullscreen="1"></iframe>'
        ),
        Utils.sTestEmbedContentFromUrl(ui,
          'https://www.youtube.com/watch?v=cOTbVN2qZBY&t=30s&index=2&list=PLfQW7NTMsSA1dTqk1dMEanFLovB4-C0FT',
          '<iframe src="//www.youtube.com/embed/cOTbVN2qZBY?t=30s&amp;index=2&amp;list=PLfQW7NTMsSA1dTqk1dMEanFLovB4-C0FT" width="560" height="314" allowFullscreen="1"></iframe>'
        ),
        Utils.sTestEmbedContentFromUrl(ui,
          'https://www.google.com',
          '<video width="300" height="150" controls="controls">\n<source src="https://www.google.com" />\n</video>'
        ),
        Utils.sAssertSizeRecalcConstrained(ui),
        Utils.sAssertSizeRecalcUnconstrained(ui),
        Utils.sAssertSizeRecalcConstrainedReopen(ui)
      ]),
      Log.stepsAsStep('TBA', 'Media: Test changing source, width and height doesn\'t delete other values', [
        apis.sSetContent(''),
        Utils.sOpenDialog(ui),
        Utils.sSetHeightAndWidth(ui, '300', '300'),
        Utils.sAssertHeightAndWidth(ui, '300', '300'),
        Utils.sChangeHeightValue(ui, ''),
        Utils.sAssertHeightAndWidth(ui, '', '300'),
        Utils.sPasteSourceValue(ui, 'https://youtu.be/G60llMJepZI'),
        Utils.sAssertHeightAndWidth(ui, '314', '300'),
        Utils.sCloseDialog(ui)
      ])
    ], onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    theme: 'silver',
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:45,代码来源:MediaPluginSanityTest.ts

示例10: function

UnitTest.asynctest('browser.core.SubmitTest', function (success, failure) {
  Plugin();
  Theme();

  const sTestEmbedContentSubmit = function (ui, editor, apis, url, expected) {
    return Logger.t(`Assert content ${expected}`, GeneralSteps.sequence([
      Utils.sOpenDialog(ui),
      Utils.sSetFormItemNoEvent(ui, url),
      ui.sClickOnUi('click save button', Utils.selectors.saveButton),
      Utils.sAssertEditorContent(apis, editor, expected)
    ]));
  };

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const ui = TinyUi(editor);
    const apis = TinyApis(editor);

    Pipeline.async({},
      Log.steps('TBA', 'Media: Open dialog, set content, submit dialog and assert content. Change setting and assert changed content', [
        sTestEmbedContentSubmit(ui, editor, apis, 'https://www.youtube.com/watch?v=IcgmSRJHu_8',
          '<p><span id="fake">https://www.youtube.com/watch?v=IcgmSRJHu_8</span></p>'),
        apis.sSetContent(''),
        apis.sDeleteSetting('media_url_resolver'),
        sTestEmbedContentSubmit(ui, editor, apis, 'https://www.youtube.com/watch?v=IcgmSRJHu_8',
          '<p><iframe src="//www.youtube.com/embed/IcgmSRJHu_8" width="560" height="314" ' +
          'allowfullscreen="allowfullscreen"></iframe></p>'),
        apis.sSetContent('')
      ])
    , onSuccess, onFailure);
  }, {
    plugins: ['media'],
    toolbar: 'media',
    theme: 'silver',
    media_url_resolver (data, resolve) {
      Delay.setTimeout(function () {
        resolve({
          html: '<span id="fake">' + data.url + '</span>'
        });
      }, 500);
    },
    base_url: '/project/tinymce/js/tinymce'
  }, success, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:43,代码来源:SubmitTest.ts


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