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


TypeScript Mouse.cClickOn方法代碼示例

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


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

示例1:

const cSubmitDialog = () => Chain.control(
  NamedChain.asChain([
    NamedChain.writeValue('body', Body.body()),
    NamedChain.read('body', Mouse.cClickOn('.tox-button:contains("Save")')),
    NamedChain.outputInput
  ]),
  Guard.addLogging('Submit dialog')
);
開發者ID:tinymce,項目名稱:tinymce,代碼行數:8,代碼來源:Helpers.ts

示例2: TinyApis

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

    const rootDoc = Element.fromDom(document);

    const sOpenContextMenu = (target) => {
      return Chain.asStep(editor, [
        tinyUi.cTriggerContextMenu('trigger image context menu', target, '.tox-silver-sink [role="menuitem"]'),
        // Not sure why this is needed, but without the browser deselects the contextmenu target
        Chain.wait(0)
      ]);
    };

    const sWaitForAndSubmitDialog = Chain.asStep(editor, [
      tinyUi.cWaitForPopup('wait for dialog', 'div[role="dialog"]'),
      Mouse.cClickOn('.tox-button:contains("Save")')
    ]);

    Pipeline.async({}, [
      tinyApis.sFocus,
      Log.stepsAsStep('TBA', 'Opening context menus on a selected figure', [
        tinyApis.sSetRawContent('<figure class="image" contenteditable="false"><img src="image.png"><figcaption contenteditable="true">Caption</figcaption></figure><p>Second paragraph</p>'),
        tinyApis.sSetSelection([], 0, [], 1),
        sOpenContextMenu('figure.image'),
        Keyboard.sKeydown(rootDoc, Keys.enter(), {}),
        sWaitForAndSubmitDialog,
        tinyApis.sAssertSelection([], 0, [], 1)
      ]),
      Log.stepsAsStep('TBA', 'Opening context menus on an unselected figure', [
        tinyApis.sSetRawContent('<figure class="image" contenteditable="false"><img src="image.png"><figcaption contenteditable="true">Caption</figcaption></figure><p>Second paragraph</p>'),
        tinyApis.sSetSelection([1, 0], 1, [1, 0], 1),
        sOpenContextMenu('figure.image'),
        Keyboard.sKeydown(rootDoc, Keys.enter(), {}),
        sWaitForAndSubmitDialog,
        tinyApis.sAssertSelection([], 0, [], 1)
      ]),
      Log.stepsAsStep('TBA', 'Opening context menus on a selected image', [
        tinyApis.sSetRawContent('<p><img src="image.png" /></p><p>Second paragraph</p>'),
        tinyApis.sSetSelection([0], 0, [0], 1),
        sOpenContextMenu('img'),
        Keyboard.sKeydown(rootDoc, Keys.enter(), {}),
        sWaitForAndSubmitDialog,
        tinyApis.sAssertSelection([0], 0, [0], 1)
      ]),
      Log.stepsAsStep('TBA', 'Opening context menus on an unselected image', [
        tinyApis.sSetRawContent('<p><img src="image.png" /></p><p>Second paragraph</p>'),
        tinyApis.sSetSelection([1, 0], 1, [1, 0], 1),
        sOpenContextMenu('img'),
        Keyboard.sKeydown(rootDoc, Keys.enter(), {}),
        sWaitForAndSubmitDialog,
        tinyApis.sAssertSelection([0], 0, [0], 1)
      ])
    ], onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:55,代碼來源:ContextMenuTest.ts

示例3: function

const assertStructureInDialog = function (errString, objStruc, waitOn, clickOn) {
    return Logger.t('Assert structure in dialog', Chain.asStep(TinyDom.fromDom(document.body), [
      UiFinder.cWaitFor('Could not find notification', waitOn),
      Mouse.cClickOn(clickOn),
      Chain.control(
        Chain.op((panel) => {
          Assertions.assertPresence(errString, objStruc, panel);
        }),
        Guard.tryUntil('Keep waiting', 100, 4000)
      )
    ]));
  };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:12,代碼來源:PluginAssert.ts

示例4: TinyApis

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

    Pipeline.async({},
      Log.steps('TBA', 'Charmap: Open dialog, click on the All tab and click on Quotation Mark and then assert Quotation Mark is inserted', [
        tinyApis.sFocus,
        tinyUi.sClickOnToolbar('click charmap', 'button[aria-label="Special character"]'),
        Chain.asStep({}, [
          Chain.fromParent(
            tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
            [
              Mouse.cClickOn('.tox-dialog__body-nav-item:contains(All)'),
              Mouse.cClickOn('.tox-collection .tox-collection__item-icon:contains(")') // Could not get span[data-glyph="\"""] or similar to work...
            ]
          )
        ]),
        tinyApis.sAssertContent('<p>"</p>')
      ])
    , onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:21,代碼來源:InsertQuotationMarkTest.ts

示例5: TestExtras


//.........這裏部分代碼省略.........

  }), '_'),

  Pipeline.async({ }, [
    Step.sync(() => {
      windowManager.open({
        title: 'Custom Dialog',
        body: {
          type: 'tabpanel',
          tabs: [
            {
              title: 'Basic',
              items: [
                {
                  name: 'basic1',
                  type: 'input'
                }
              ]
            },
            {
              title: 'Advanced',
              items: [
                {
                  name: 'advanced1',
                  type: 'textarea'
                }
              ]
            }
          ]
        },
        buttons: [
          {
            type: 'custom',
            name: 'gotoBasic',
            text: '-> Basic',
            disabled: false
          },
          {
            type: 'custom',
            name: 'gotoAdvanced',
            text: '-> Advanced',
            disabled: false
          },
          {
            type: 'cancel',
            text: 'Cancel'
          },
          {
            type: 'submit',
            text: 'Save'
          }
        ],
        initialData: {
          basic1: 'First tab value',
          advanced1: 'Textarea value'
        },
        onAction: (api, a) => {
          const target = a.name === 'gotoBasic' ? 'Basic' : 'Advanced';
          api.showTab(target);
        },
        onSubmit: () => {

        }
      }, {}, () => {});
    }),

    Chain.asStep({ }, [
      NamedChain.asChain([
        NamedChain.writeValue('page', Body.body()),
        NamedChain.direct('page', UiFinder.cFindIn('[role="dialog"]'), 'dialog'),
        NamedChain.direct('dialog', UiFinder.cFindIn('[role="tab"]:contains("Basic")'), 'basicTab'),
        NamedChain.direct('dialog', UiFinder.cFindIn('[role="tab"]:contains("Advanced")'), 'advancedTab'),
        NamedChain.direct('dialog', UiFinder.cFindIn('[role="tabpanel"]'), 'tabview'),
        NamedChain.direct('dialog', Mouse.cClickOn('button:contains("-> Basic")'), '_'),
        NamedChain.direct('tabview', cAssertFormContents('Clicking Basic button', (s, str, arr) => {
          return s.element('input', {
            value: str.is('First tab value')
          });
        }), '_'),

        NamedChain.direct('dialog', Mouse.cClickOn('button:contains("-> Advanced")'), '_'),
        NamedChain.direct('tabview', cAssertFormContents('Clicking Advanced button (not tab)', (s, str, arr) => {
          return s.element('textarea', {
            value: str.is('Textarea value')
          });
        }), '_'),

        NamedChain.direct('dialog', Mouse.cClickOn('button:contains("-> Basic")'), '_'),
        NamedChain.direct('tabview', cAssertFormContents('Clicking Basic button again (not tab)', (s, str, arr) => {
          return s.element('input', {
            value: str.is('First tab value')
          });
        }), '_'),
      ])
    ])
  ], () => {
    helpers.destroy();
    success();
  }, failure);
});
開發者ID:tinymce,項目名稱:tinymce,代碼行數:101,代碼來源:TabbedDialogTest.ts


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