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


TypeScript Keys.left方法代码示例

本文整理汇总了TypeScript中@ephox/agar.Keys.left方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Keys.left方法的具体用法?TypeScript Keys.left怎么用?TypeScript Keys.left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/agar.Keys的用法示例。


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

示例1: TinyApis

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

    Pipeline.async({}, [
      tinyApis.sFocus,
      Logger.t('Type text before cef inline element', GeneralSteps.sequence([
        tinyApis.sSetContent('<p><span contenteditable="false">a</span></p>'),
        tinyApis.sSelect('p', [1]),
        tinyActions.sContentKeystroke(Keys.left(), {}),
        TypeText.sTypeContentAtSelection(Element.fromDom(editor.getDoc()), 'bc'),
        tinyApis.sAssertSelection([0, 0], 2, [0, 0], 2),
        tinyApis.sAssertContent('<p>bc<span contenteditable="false">a</span></p>')
      ])),
      Logger.t('Type after cef inline element', GeneralSteps.sequence([
        tinyApis.sSetContent('<p><span contenteditable="false">a</span></p>'),
        tinyApis.sSelect('p', [1]),
        tinyActions.sContentKeystroke(Keys.right(), {}),
        TypeText.sTypeContentAtSelection(Element.fromDom(editor.getDoc()), 'bc'),
        tinyApis.sAssertSelection([0, 1], 3, [0, 1], 3),
        tinyApis.sAssertContent('<p><span contenteditable="false">a</span>bc</p>')
      ])),
      Logger.t('Type between cef inline elements', GeneralSteps.sequence([
        tinyApis.sSetContent('<p><span contenteditable="false">a</span>&nbsp;<span contenteditable="false">b</span></p>'),
        tinyApis.sSelect('p', [3]),
        tinyActions.sContentKeystroke(Keys.left(), {}),
        tinyActions.sContentKeystroke(Keys.left(), {}),
        TypeText.sTypeContentAtSelection(Element.fromDom(editor.getDoc()), 'bc'),
        tinyApis.sAssertSelection([0, 1], 3, [0, 1], 3),
        tinyApis.sAssertContent('<p><span contenteditable="false">a</span>bc&nbsp;<span contenteditable="false">b</span></p>')
      ]))
    ], onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:33,代码来源:TypeTextAtCefTest.ts

示例2: function

  const sTestArrowsSingleAnchor = function (tinyApis, tinyActions, editor) {
    return Logger.t('sTestArrowsSingleAnchor', GeneralSteps.sequence([
      tinyApis.sSetContent('<p><a href="#">b</a></p>'),

      tinyApis.sSetCursor([0, 0, 0], 0),
      tinyApis.sNodeChanged,
      sAssertCursor(tinyApis, [0, 0, 0], 1),
      sAssertContentStructure(editor, anchorsZwspInside(['b'], START, 0)),

      tinyActions.sContentKeystroke(Keys.left(), { }),
      sAssertCursor(tinyApis, [0, 0], 0),
      sAssertContentStructure(editor, anchorsZwspOutside(['b'], BEFORE, 0)),

      tinyActions.sContentKeystroke(Keys.left(), { }),
      sAssertCursor(tinyApis, [0, 0], 0),
      sAssertContentStructure(editor, anchorsZwspOutside(['b'], BEFORE, 0)),

      tinyActions.sContentKeystroke(Keys.right(), { }),
      sAssertCursor(tinyApis, [0, 0, 0], 1),
      sAssertContentStructure(editor, anchorsZwspInside(['b'], START, 0)),

      tinyActions.sContentKeystroke(Keys.right(), { }),
      sAssertCursor(tinyApis, [0, 0, 0], 1),
      sAssertContentStructure(editor, anchorsZwspInside(['b'], END, 0)),

      tinyActions.sContentKeystroke(Keys.right(), { }),
      sAssertCursor(tinyApis, [0, 1], 1),
      sAssertContentStructure(editor, anchorsZwspOutside(['b'], AFTER, 0)),

      tinyActions.sContentKeystroke(Keys.right(), { }),
      sAssertCursor(tinyApis, [0, 1], 1),
      sAssertContentStructure(editor, anchorsZwspOutside(['b'], AFTER, 0))
    ]));
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:34,代码来源:ArrowKeysAnchorTest.ts

示例3: table

    TinyLoader.setup(function (editor, onSuccess, onFailure) {
      Pipeline.async({}, [
        Logger.t('FakeCaret before/after table', GeneralSteps.sequence(browser.isEdge() || browser.isFirefox() ? [
          Logger.t('Move fake caret left before table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.left()),
            ApiChains.cAssertContentStructure(buildBody([ caretBefore(), table('1'), visualCaretBefore() ])),
            ApiChains.cAssertSelection([0], 0, [0], 0)
          ])),
          Logger.t('Move fake caret right after table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.right()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), visualCaretAfter() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake caret right after table then right again before other table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
            ActionChains.cContentKeystroke(Keys.right()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0),
            ActionChains.cContentKeystroke(Keys.right()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake caret left before table then left again after other table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
            ApiChains.cSetCursor([1, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
            ActionChains.cContentKeystroke(Keys.left()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0),
            ActionChains.cContentKeystroke(Keys.left()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake up for when table is first element', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.up()),
            ApiChains.cAssertContentStructure(buildBody([ block, table('1') ])),
            ApiChains.cAssertSelection([0], 0, [0], 0)
          ])),
          Logger.t('Move fake down for when table is last element', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.down()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), block ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake up for when table is first element but not when caret is not as start', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.up()),
            ApiChains.cAssertContentStructure(buildBody([ block, table('1') ])),
            ApiChains.cAssertSelection([0], 0, [0], 0)
          ])),
          Logger.t('Move fake down for when table is last element but not when caret is not as end', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.down()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), block ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ]))] : []
        )),

        Logger.t('Table cell navigation', GeneralSteps.sequence([
          Logger.t('Should move to the cell above the current cell on key up', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent(`
              <table>
                <tbody>
                  <tr><td>1</td><td>2</td></tr>
                  <tr><td>2</td><td>3</td></tr>
                </tbody>
              </table>
            `),
            ApiChains.cSetCursor([0, 0, 1, 1, 0], 0),
            ActionChains.cContentKeystroke(Keys.up()),
            ApiChains.cAssertSelection([0, 0, 0, 1, 0], 0, [0, 0, 0, 1, 0], 0)
          ])),
          Logger.t('Should move to the cell below the current cell on key down', Chain.asStep(editor, [
            ApiChains.cFocus,
//.........这里部分代码省略.........
开发者ID:danielpunkass,项目名称:tinymce,代码行数:101,代码来源:ArrowKeysTableTest.ts

示例4: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const tinyActions = TinyActions(editor);
    let count;

    // hijack editor.selection.normalize() to count how many times it will be invoked
    const backupNormalize = editor.selection.normalize;
    const normalize = function () {
      count = count === undefined ? 1 : count + 1;
      backupNormalize.apply(this, arguments);
    };
    editor.selection.normalize = normalize;

    const sResetNormalizeCounter = function () {
      return Step.sync(function () {
        count = 0;
      });
    };

    const sAssertNormalizeCounter = function (expected) {
      return Step.sync(function () {
        Assertions.assertEq('checking normalization counter', expected, count);
      });
    };

    const sClickBody = function (editor) {
      return Step.sync(function () {
        const target = editor.getBody();

        editor.fire('mousedown', { target });
        editor.fire('mouseup', { target });
        editor.fire('click', { target });
      });
    };

    Pipeline.async({}, [
      tinyApis.sFocus,

      Logger.t('Test normalization for floated images', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a<img src="about:blank" style="float: right"></p>'),
        tinyApis.sSetSelection([0], 1, [0], 2),
        Step.sync(function () {
          const selection = editor.selection.getSel();
          Assertions.assertEq('Anchor node should be the paragraph not the text node', 'P', selection.anchorNode.nodeName);
          Assertions.assertEq('Anchor offset should be the element index', 1, selection.anchorOffset);
        })
      ])),

      Logger.t('Normalize on key events when range is collapsed', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p><p>b</p>'),
        tinyApis.sSetSelection([], 1, [], 1),
        tinyActions.sContentKeystroke(Keys.escape(), {}),
        tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
      ])),

      Logger.t('Normalize on mouse events when range is expanded', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p><p>b</p>'),
        tinyApis.sSetSelection([], 0, [], 1),
        sClickBody(editor),
        tinyApis.sAssertSelection([0, 0], 0, [0, 0], 1)
      ])),

      Logger.t('Normalize on mouse events when range is collapsed', GeneralSteps.sequence([
        tinyApis.sSetContent('<p>a</p><p>b</p>'),
        tinyApis.sSetSelection([], 1, [], 1),
        sClickBody(editor),
        tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
      ])),

      Logger.t('Normalization during operations with modifier keys, should run only once in the end when user releases modifier key.', GeneralSteps.sequence([
        sResetNormalizeCounter(),
        tinyApis.sSetContent('<p><b>a</b><i>a</i></p>'),
        tinyApis.sSetSelection([0, 0, 0], 0, [0, 0], 0),
        Keyboard.sKeyup(Element.fromDom(editor.getDoc()), Keys.left(), { shift: true }),
        sAssertNormalizeCounter(0),
        Keyboard.sKeyup(Element.fromDom(editor.getDoc()), 17, {}), // single ctrl
        sAssertNormalizeCounter(1),
        tinyApis.sAssertSelection([0, 0], 0, [0, 0], 0)
      ]))
    ], onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:81,代码来源:SelectionQuirksTest.ts

示例5: TinyApis

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

      Pipeline.async({}, [
        tinyApis.sFocus,
        Logger.t('Arrow keys anchor with text', GeneralSteps.sequence([
          Logger.t('From start to end inside anchor over text', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#">x</a></p>'),
            tinyApis.sSetCursor([0, 0, 0], 0),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.right(), { }),
            tinyApis.sAssertSelection([0, 0, 0], 1, [0, 0, 0], 1),
            sAssertCaretAtZwsp(editor)
          ])),
          Logger.t('From start to before anchor with text', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#">x</a></p>'),
            tinyApis.sSetCursor([0, 0, 0], 0),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.left(), { }),
            tinyApis.sAssertSelection([0, 0], 0, [0, 0], 0),
            sAssertCaretAtZwsp(editor)
          ])),
          Logger.t('From end to after anchor with text', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#">x</a></p>'),
            tinyApis.sSetCursor([0, 0, 0], 1),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.right(), { }),
            tinyApis.sAssertSelection([0, 1], 1, [0, 1], 1),
            sAssertCaretAfterZwsp(editor)
          ])),
          Logger.t('From end to start inside anchor over text', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#">x</a></p>'),
            tinyApis.sSetCursor([0, 0, 0], 1),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.left(), { }),
            tinyApis.sAssertSelection([0, 0, 0], 1, [0, 0, 0], 1),
            sAssertCaretAfterZwsp(editor)
          ]))
        ])),

        Logger.t('Arrow keys anchor with image', GeneralSteps.sequence([
          Logger.t('From start to end inside anchor over img', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#"><img src="#"></a></p>'),
            tinyApis.sSetCursor([0, 0], 0),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.right(), { }),
            tinyApis.sAssertSelection([0, 0, 1], 0, [0, 0, 1], 0),
            sAssertCaretAtZwsp(editor)
          ])),
          Logger.t('From start to before on anchor with img', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#"><img src="#"></a></p>'),
            tinyApis.sSetCursor([0, 0], 0),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.left(), { }),
            tinyApis.sAssertSelection([0, 0], 0, [0, 0], 0),
            sAssertCaretAtZwsp(editor)
          ])),
          Logger.t('From end to after on anchor with img', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#"><img src="#"></a></p>'),
            tinyApis.sSetCursor([0, 0], 1),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.right(), { }),
            tinyApis.sAssertSelection([0, 1], 1, [0, 1], 1),
            sAssertCaretAfterZwsp(editor)
          ])),
          Logger.t('From end to start inside anchor over img', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#"><img src="#"></a></p>'),
            tinyApis.sSetCursor([0, 0], 1),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.left(), { }),
            tinyApis.sAssertSelection([0, 0, 0], 1, [0, 0, 0], 1),
            sAssertCaretAfterZwsp(editor)
          ]))
        ])),

        Logger.t('Arrow keys between blocks', GeneralSteps.sequence([
          Logger.t('From end of anchor text to after anchor to start of anchor in next paragraph', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#">a</a></p><p><a href="#">b</a></p>'),
            tinyApis.sSetCursor([0, 0, 0], 1),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.right(), { }),
            tinyApis.sSetCursor([0, 1], 1),
            sAssertCaretAfterZwsp(editor),
            tinyActions.sContentKeystroke(Keys.right(), { }),
            tinyApis.sAssertSelection([1, 0, 0], 1, [1, 0, 0], 1),
            sAssertCaretAfterZwsp(editor)
          ])),
          Logger.t('From start of anchor text to before anchor to end of anchor in previous paragraph', GeneralSteps.sequence([
            tinyApis.sSetRawContent('<p><a href="#">a</a></p><p><a href="#">b</a></p>'),
            tinyApis.sSetCursor([1, 0, 0], 0),
            tinyApis.sNodeChanged,
            tinyActions.sContentKeystroke(Keys.left(), { }),
            tinyApis.sSetCursor([1, 0], 0),
            sAssertCaretAtZwsp(editor),
            tinyActions.sContentKeystroke(Keys.left(), { }),
            tinyApis.sAssertSelection([0, 0, 0], 1, [0, 0, 0], 1),
            sAssertCaretAtZwsp(editor)
          ])),
          Logger.t('From end of anchor text to after anchor to but not to next paragraph', GeneralSteps.sequence([
//.........这里部分代码省略.........
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:ArrowKeysInlineBoundariesTest.ts

示例6: TinyApis


//.........这里部分代码省略.........
        sAssertFocusOnItem('Formats'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Blocks'),
        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnItem('Paragraph'),
        sAssertItemTicks('Checking blocks in menu', [ false, true ].concat(
          range(6, () => false)
        )),
        Keyboard.sKeydown(doc, Keys.escape(), { }),
        Keyboard.sKeydown(doc, Keys.escape(), { })
      ]);

      const sTestStyleSelect = Log.stepsAsStep('TBA', 'Checking style ticks and updating', [
        tinyApis.sSetContent('<p>First paragraph</p><p>Second paragraph</p>'),
        tinyApis.sSetCursor([ 0, 0 ], 'Fi'.length),
        sOpenMenu('Format', 'Paragraph:last'),
        sAssertFocusOnItem('Headings'),
        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnItem('Heading 1'),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        UiFinder.sNotExists(Body.body(), '[role="menu"]'),

        sCheckSubItemsAtLocation('Heading 1')(
          'First block after "h1',
          [ true ].concat(range(5, () => false)),
          'Heading 1:last',
          [ 0, 0 ], 'Fi'.length
        ),

        sCheckSubItemsAtLocation('Heading 1')(
          'Second paragraph with no set format',
          range(6, () => false),
          'Paragraph:last',
          [ 1, 0 ], 'Se'.length
        ),

        sCheckSubItemsAtLocation('Heading 1')(
          'First block with the "h1" set previously',
          [ true ].concat(range(5, () => false)),
          'Heading 1:last',
          [ 0, 0 ], 'Fi'.length
        ),

        // Check that the menus are working also
        Mouse.sClickOn(Body.body(), '[role="menubar"] [role="menuitem"]:contains("Format")'),
        sAssertFocusOnItem('Bold'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Italic'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Underline'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Strikethrough'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Superscript'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Subscript'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Code'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Formats'),
        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnItem('Headings'),
        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnItem('Heading 1'),
        sAssertItemTicks('Checking headings in menu', [ true ].concat(
          range(5, () => false)
        )),
        Keyboard.sKeydown(doc, Keys.escape(), { }),
        Keyboard.sKeydown(doc, Keys.escape(), { }),
        Keyboard.sKeydown(doc, Keys.escape(), { })
      ]);

      const sTestToolbarKeyboardNav = Log.stepsAsStep('TBA', 'Checking toolbar keyboard navigation', [
        tinyApis.sSetContent('<p>First paragraph</p><p>Second paragraph</p>'),
        tinyApis.sSetCursor([ 0, 0 ], 'Fi'.length),
        sOpenAlignMenu('Align'),
        sAssertFocusOnItem('Left'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Center'),

        // Check moving left and right closes the open dropdown and navigates to the next item
        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnToolbarButton('Verdana'), // Font Select
        UiFinder.sNotExists(Body.body(), '[role="menu"]'),
        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Andale Mono'),
        Keyboard.sKeydown(doc, Keys.left(), { }),
        sAssertFocusOnAlignToolbarButton(), // Alignment
        UiFinder.sNotExists(Body.body(), '[role="menu"]')
      ]);

      Pipeline.async({ }, [
        sTestAlignment,
        sTestFontSelect,
        sTestFontSizeSelect,
        sTestFormatSelect,
        sTestStyleSelect,
        sTestToolbarKeyboardNav
      ], onSuccess, onFailure);
    },
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:SilverBespokeButtonsTest.ts

示例7: sAssertFocusOnMenuButton


//.........这里部分代码省略.........

        Step.sync(() => {
          SilverMenubar.focus(menubar);
        }),

        sAssertFocusOnMenuButton('Changes'),
        Keyboard.sKeydown(doc, Keys.space(), { }),
        sWaitForMenuToAppear(),
        sAssertFocusOnToggleItem('Remember me'),
        sAssertActiveToggleItemHasOneCheckmark('Remember me'),
        Keyboard.sKeydown(doc, Keys.escape(), { }),
        sAssertFocusOnMenuButton('Changes'),
        sWaitForMenuToDisappear(),

        Keyboard.sKeydown(doc, Keys.right(), {}),
        sAssertFocusOnMenuButton('Basic Menu Button'),

        Keyboard.sKeydown(doc, Keys.space(), { }),
        sWaitForMenuToAppear(),
        sAssertFocusOnItem('Item1'),

        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Item2'),

        Keyboard.sKeydown(doc, Keys.down(), { }),
        sAssertFocusOnItem('Nested'),

        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnItem('Nested menu x 2'),

        Keyboard.sKeydown(doc, Keys.right(), { }),
        sAssertFocusOnItem('Nested menu x 3'),

        Keyboard.sKeydown(doc, Keys.left(), { }),
        sAssertFocusOnItem('Nested menu x 2'),

        Keyboard.sKeydown(doc, Keys.escape(), { }),
        sAssertFocusOnItem('Nested'),

        Keyboard.sKeydown(doc, Keys.escape(), { }),
        sAssertFocusOnMenuButton('Basic Menu Button'),
        sWaitForMenuToDisappear(),

        Keyboard.sKeydown(doc, Keys.enter(), { }),
        sWaitForMenuToAppear(),
        sAssertFocusOnItem('Item1'),

        Keyboard.sKeydown(doc, Keys.up(), { }),
        sAssertFocusOnItem('Nested'),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        sAssertFocusOnItem('Nested menu x 2'),

        Keyboard.sKeydown(doc, Keys.escape(), { }),
        sAssertFocusOnItem('Nested'),
        Keyboard.sKeydown(doc, Keys.up(), { }),
        Keyboard.sKeydown(doc, Keys.enter(), { }),
        Logger.t(
          'Pressing <enter> on an item without a submenu should trigger it and close the menu',
          GeneralSteps.sequence([
            sWaitForMenuToDisappear(),
            store.sAssertEq('Store should have evidence of item triggered', [ 'menuitem-2 action' ])
          ])
        ),

        store.sClear,
        Step.sync(() => {
开发者ID:tinymce,项目名称:tinymce,代码行数:67,代码来源:SilverMenubarTest.ts

示例8: table

 TinyLoader.setup(function (editor, onSuccess, onFailure) {
   Pipeline.async({}, browser.isEdge() || browser.isFirefox() ? [
     Logger.t('Move fake caret left before table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.left()),
       ApiChains.cAssertContentStructure(buildBody([ caretBefore(), table('1'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([0], 0, [0], 0)
     ])),
     Logger.t('Move fake caret right after table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.right()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake caret right after table then right again before other table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
       ActionChains.cContentKeystroke(Keys.right()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0),
       ActionChains.cContentKeystroke(Keys.right()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake caret left before table then left again after other table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
       ApiChains.cSetCursor([1, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
       ActionChains.cContentKeystroke(Keys.left()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0),
       ActionChains.cContentKeystroke(Keys.left()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake up for when table is first element', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.up()),
       ApiChains.cAssertContentStructure(buildBody([ caretBefore(), table('1'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([0], 0, [0], 0)
     ])),
     Logger.t('Move fake down for when table is last element', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.down()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake up for when table is first element but not when caret is not as start', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.up()),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ApiChains.cAssertSelection([0, 0, 0, 0, 0], 1, [0, 0, 0, 0, 0], 1)
     ])),
     Logger.t('Move fake down for when table is last element but not when caret is not as end', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.down()),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ApiChains.cAssertSelection([0, 0, 0, 0, 0], 0, [0, 0, 0, 0, 0], 0)
     ]))
   ] : [], onSuccess, onFailure);
 }, {
开发者ID:,项目名称:,代码行数:82,代码来源:


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