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


TypeScript agar.Mouse类代码示例

本文整理汇总了TypeScript中@ephox/agar.Mouse的典型用法代码示例。如果您正苦于以下问题:TypeScript Mouse类的具体用法?TypeScript Mouse怎么用?TypeScript Mouse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TinyApis

  TinyLoader.setup((editor, onSuccess, onFailure) => {
    const tinyApis = TinyApis(editor);

    const dialogSelector = 'div.tox-dialog';
    const toolbarButtonSelector = '[role="toolbar"] button[aria-label="Insert template"]';

    const docBody = Element.fromDom(document.body);

    Pipeline.async({}, [
      Log.stepsAsStep('TBA', 'Template: Test selectedcontent replacement with default class', [
        tinyApis.sSetContent('Text'),
        tinyApis.sSetSelection([0, 0], 0, [0, 0], 4),
        tinyApis.sSetSetting('templates', [{ title: 'a', description: 'b', content: '<h1 class="selcontent">This will be replaced</h1>' }]),
        Mouse.sClickOn(Element.fromDom(editor.getContainer()), toolbarButtonSelector),
        UiFinder.sWaitForVisible('Waited for dialog to be visible', docBody, dialogSelector),
        Mouse.sClickOn(docBody, 'button.tox-button:contains(Save)'),
        Waiter.sTryUntil('Dialog should close', UiFinder.sNotExists(docBody, dialogSelector), 100, 3000),
        tinyApis.sAssertContent('<h1 class="selcontent">Text</h1>')
      ]),

      Log.stepsAsStep('TBA', 'Template: Test selectedcontent replacement with custom class', [
        tinyApis.sSetContent('Text'),
        tinyApis.sSetSelection([0, 0], 0, [0, 0], 4),
        tinyApis.sSetSetting('template_selected_content_classes', 'customSelected'),
        tinyApis.sSetSetting('templates', [{ title: 'a', description: 'b', content: '<h1 class="customSelected">This will be replaced/h1>' }]),
        Mouse.sClickOn(Element.fromDom(editor.getContainer()), toolbarButtonSelector),
        UiFinder.sWaitForVisible('Waited for dialog to be visible', docBody, dialogSelector),
        Mouse.sClickOn(docBody, 'button.tox-button:contains(Save)'),
        Waiter.sTryUntil('Dialog should close', UiFinder.sNotExists(docBody, dialogSelector), 100, 3000),
        tinyApis.sAssertContent('<h1 class="customSelected">Text</h1>')
      ])
    ], onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:33,代码来源:SelectedContentTest.ts

示例2: from

 const cResizeToPos = (sx: number, sy: number, dx: number, dy: number, delta: number = 10) => {
   // Simulate moving the mouse, by making a number of movements
   const numMoves = sy === dy ? Math.abs(dx - sx) / delta : Math.abs(dy - sy) / delta;
   // Determine the deltas based on the number of moves to make
   const deltaX = (dx - sx) / numMoves;
   const deltaY = (dy - sy) / numMoves;
   // Move and release the mouse
   return Chain.control(
     Chain.fromChains([
         UiFinder.cFindIn('.tox-blocker'),
         Mouse.cMouseMoveTo(sx, sy)
       ].concat(
         Arr.range(numMoves, (count) => {
           const nx = sx + count * deltaX;
           const ny = sy + count * deltaY;
           return Mouse.cMouseMoveTo(nx, ny);
         })
       ).concat([
         Mouse.cMouseMoveTo(dx, dy),
         Mouse.cMouseUp
       ])
     ),
     Guard.addLogging(`Resizing from (${sx}, ${sy}) to (${dx}, ${dy})`)
   );
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:25,代码来源:ResizeTest.ts

示例3:

 const sDragDrop = (container, selector, dx, dy) => {
   return Logger.t('Drag from a point and drop at specified point', Chain.asStep(container, [
     UiFinder.cFindIn(selector),
     Mouse.cMouseDown,
     Mouse.cMouseMoveTo(dx, dy),
     Mouse.cMouseUpTo(dx, dy)
   ]));
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:DragResizeTest.ts

示例4: function

 const sDragDrop = function (container, selector, dx, dy) {
   return Chain.asStep(container, [
     UiFinder.cFindIn(selector),
     Mouse.cMouseDown,
     Mouse.cMouseMoveTo(dx, dy),
     Mouse.cMouseUpTo(dx, dy)
   ]);
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:8,代码来源:DragResizeTest.ts

示例5: TinyApis

  TinyLoader.setup((editor: Editor, onSuccess, onFailure) => {
    const tinyApis = TinyApis(editor);

    const docBody = Element.fromDom(document.body);

    const sSetTextareaContent = (content) => {
      return Logger.t('Changing textarea content to ' + content, Step.sync(() => {
        const textarea: any = document.querySelector('div[role="dialog"] textarea');
        textarea.value = content;
      }));
    };

    const sAssertTextareaContent = (expected) => {
      return Logger.t('Asserting textarea content is ' + expected, Step.sync(() => {
        const textarea: any = document.querySelector('div[role="dialog"] textarea');
        RawAssertions.assertEq('Should have correct value', expected, textarea.value);
      }));
    };

    const sSubmitDialog = (docBody) => {
      return GeneralSteps.sequence(Logger.ts('Clicking on the Save button to close dialog', [
        FocusTools.sSetFocus('Focus dialog', docBody, dialogSelector),
        Mouse.sClickOn(docBody, 'button.tox-button:contains(Save)'),
        Waiter.sTryUntil('Dialog should close', UiFinder.sNotExists(docBody, dialogSelector), 100, 3000)
      ]));
    };

    Pipeline.async({}, [
      Log.stepsAsStep('TBA', 'Code: Set content in empty editor and assert values', [
        Mouse.sClickOn(Element.fromDom(editor.getContainer()), toolbarButtonSelector),
        UiFinder.sWaitForVisible('Waited for dialog to be visible', docBody, dialogSelector),
        sAssertTextareaContent(''),
        sSetTextareaContent('<em>a</em>'),
        sSubmitDialog(docBody),
        tinyApis.sAssertContent('<p><em>a</em></p>'),
      ]),

      Log.stepsAsStep('TBA', 'Code: Reopen dialog and check textarea content is correct', [
        Mouse.sClickOn(Element.fromDom(editor.getContainer()), toolbarButtonSelector),
        UiFinder.sWaitForVisible('Waited for dialog to be visible', docBody, dialogSelector),
        sAssertTextareaContent('<p><em>a</em></p>')
      ]),

      Log.stepsAsStep('TBA', 'Code: Change source code and assert editor content changes', [
        sSetTextareaContent('<strong>b</strong>'),
        sSubmitDialog(docBody),
        tinyApis.sAssertContent('<p><strong>b</strong></p>'),
      ]),
    ], onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:50,代码来源:CodeSanityTest.ts

示例6: sAssertCodeSampleDialog

const sOpenDialogAndAssertInitial = (editor, docBody, language, content) => {
  return GeneralSteps.sequence(Logger.ts('Open dialog and assert initial language and content', [
    Mouse.sClickOn(Element.fromDom(editor.getContainer()), toolbarButtonSelector),
    UiFinder.sWaitForVisible('Waited for dialog to be visible', docBody, dialogSelector),
    sAssertCodeSampleDialog(language, content)
  ]));
};
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:CodeSampleTestUtils.ts

示例7: insertTablePickerApprox

    (editor, onSuccess, onFailure) => {
      const doc = Element.fromDom(document);

      Pipeline.async({ }, Log.steps(
        'TBA',
        'Check structure of table picker',
        [
          Mouse.sClickOn(Body.body(), '.tox-toolbar button'),
          UiFinder.sWaitForVisible('Waiting for menu', Body.body(), '[role="menu"]'),
          Chain.asStep(Body.body(), [
            UiFinder.cFindIn('[role="menu"]'),
            Assertions.cAssertStructure(
              'Checking structure',
              ApproxStructure.build((s, str, arr) => insertTablePickerApprox(s, str, arr, 1, 1))
            )
          ]),
          FocusTools.sTryOnSelector('Focus should be on first table cell', doc, '.tox-insert-table-picker__selected:last'),
          Keyboard.sKeydown(doc, Keys.down(), {}),
          Keyboard.sKeydown(doc, Keys.right(), {}),
          Chain.asStep(Body.body(), [
            UiFinder.cFindIn('[role="menu"]'),
            Assertions.cAssertStructure(
              'Checking structure',
              ApproxStructure.build((s, str, arr) => insertTablePickerApprox(s, str, arr, 2, 2))
            )
          ]),
          FocusTools.sTryOnSelector('Focus should be on 2 down, 2 across table cell', doc, '.tox-insert-table-picker__selected:last')
        ]
      ), onSuccess, onFailure);
    },
开发者ID:tinymce,项目名称:tinymce,代码行数:30,代码来源:OxideTablePickerMenuTest.ts

示例8:

 const sSubmitDialog = (docBody) => {
   return GeneralSteps.sequence(Logger.ts('Clicking on the Save button to close dialog', [
     FocusTools.sSetFocus('Focus dialog', docBody, dialogSelector),
     Mouse.sClickOn(docBody, 'button.tox-button:contains(Save)'),
     Waiter.sTryUntil('Dialog should close', UiFinder.sNotExists(docBody, dialogSelector), 100, 3000)
   ]));
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:CodeSanityTest.ts

示例9: sTestOpen

  const testDialog = (label: string, params: { inline?: string }) => Logger.t(
    `Testing ${label}`,
    GeneralSteps.sequence([
      store.sClear,
      Logger.t(
        'Open a dialog, with a change button that accesses API asynchronously',
        sTestOpen(params)
      ),

      Logger.t(
        'Trigger the async functions by clicking on the button',
        Mouse.sClickOn(Body.body(), 'button:contains("Call")')
      ),

      Logger.t(
        'Click on the close button, so that dialog is shut down',
        sTestClose
      ),

      Waiter.sTryUntil(
        'Wait until getData and setData calls fire asynchronously',
        store.sAssertEq('Checking stuff', [
          'onCancel',
          'closeWindow',
          'onClose',
          'currentData: Init Value',
          'newData: Init Value'
        ]),
        100,
        5000
      )
    ])
  );
开发者ID:tinymce,项目名称:tinymce,代码行数:33,代码来源:SilverDialogApiAccessTest.ts


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