當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript agar.RealMouse類代碼示例

本文整理匯總了TypeScript中@ephox/agar.RealMouse的典型用法代碼示例。如果您正苦於以下問題:TypeScript RealMouse類的具體用法?TypeScript RealMouse怎麽用?TypeScript RealMouse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了RealMouse類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: TinyApis

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

    // Cut doesn't seem to work in webdriver mode on ie, firefox is producing moveto not supported, edge fails if it's not observed
    Pipeline.async({}, (platform.browser.isIE() || platform.browser.isFirefox() || platform.browser.isEdge()) ? [] : [
      api.sSetContent('<p>abc</p>'),
      api.sSetSelection([0, 0], 1, [0, 0], 2),
      ui.sClickOnMenu('Click Edit menu', 'button:contains("Edit")'),
      ui.sWaitForUi('Wait for dropdown', '.mce-floatpanel[role="application"]'),
      RealMouse.sClickOn('.mce-i-cut'),
      Waiter.sTryUntil('Cut is async now, so need to wait for content', api.sAssertContent('<p>ac</p>'), 100, 1000)
    ], onSuccess, onFailure);
  }, {
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:14,代碼來源:CutTest.ts

示例2: TinyApis

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

    // Cut doesn't seem to work in webdriver mode on ie, firefox is producing moveto not supported, edge fails if it's not observed
    Pipeline.async({}, (platform.browser.isIE() || platform.browser.isFirefox() || platform.browser.isEdge()) ? [] :
    Log.steps('TBA', 'Paste: Set and select content, cut using edit menu and assert cut content', [
      api.sSetContent('<p>abc</p>'),
      api.sSetSelection([0, 0], 1, [0, 0], 2),
      ui.sClickOnMenu('Click Edit menu', 'button:contains("Edit")'),
      Chain.asStep({}, [
        ui.cWaitForUi('Wait for menu item', '[role="menuitem"]:contains("Cut")'),
        RealMouse.cClick()
      ]),
      Waiter.sTryUntil('Cut is async now, so need to wait for content', api.sAssertContent('<p>ac</p>'), 100, 1000)
    ]), onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:17,代碼來源:CutTest.ts

示例3: Test

UnitTest.asynctest('Dialog Focus Test (webdriver)', (success, failure) => {
  const helpers = TestExtras();
  const windowManager = WindowManager.setup(helpers.extras);

  const doc = Element.fromDom(document);

  const isPhantomJs = function () {
    return /PhantomJS/.test(window.navigator.userAgent);
  };

  const tests =
    isPhantomJs ? [ ] : [
      TestHelpers.GuiSetup.mAddStyles(doc, [
        '[role="dialog"] { border: 1px solid black; padding: 2em; background-color: rgb(131,193,249); top: 40px; position: absolute; }',

        ':focus { outline: 3px solid green; !important; }',
      ]),

      Step.sync(() => {
        windowManager.open({
          title: 'Custom Dialog',
          body: {
            type: 'panel',
            items: [
              {
                name: 'input1',
                type: 'input'
              }
            ]
          },
          buttons: [
            {
              type: 'cancel',
              text: 'Close'
            }
          ],
          initialData: {
            input1: 'Dog'
          }
        }, { }, Fun.noop);
      }),

      FocusTools.sTryOnSelector(
        'focus should start on input',
        doc,
        '.tox-textfield'
      ),

      RealMouse.sClickOn('body'),

      FocusTools.sTryOnSelector(
        'focus should be on body',
        doc,
        'body'
      ),

      RealMouse.sClickOn('.tox-dialog'),

      FocusTools.sTryOnSelector(
        'focus should move to input after clicking on the dialog',
        doc,
        '.tox-textfield'
      ),

      RealMouse.sClickOn('body'),

      FocusTools.sTryOnSelector(
        'focus should be on body (again)',
        doc,
        'body'
      ),

      RealMouse.sClickOn('.tox-dialog__footer'),

      FocusTools.sTryOnSelector(
        'focus should move to input after clicking on the dialog footer',
        doc,
        '.tox-textfield'
      ),
    ];

  Pipeline.async({ }, tests, () => {
    helpers.destroy();
    success();
  }, failure);
});
開發者ID:tinymce,項目名稱:tinymce,代碼行數:86,代碼來源:DialogFocusTest.ts


注:本文中的@ephox/agar.RealMouse類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。