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


TypeScript Editor.type方法代码示例

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


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

示例1: it

    it("changing label visibility level", async () => {
      // Changing label visibility does not merely refresh the errors but
      // recreates them because errors that were visible may become invisible or
      // errors that were invisible may become visible.

      await processRunner.onCompleted();
      // tslint:disable-next-line:no-any
      const errorLayer = (editor as any).errorLayer.el as Element;
      let orig = _slice.call(errorLayer.children);

      // Reduce the visibility level.
      editor.type(keyConstants.LOWER_LABEL_VISIBILITY);
      let after;
      await waitForSuccess(() => {
        after = _slice.call(errorLayer.children);
        assertNewMarkers(orig, after, "decreasing the level");
      });

      orig = after;

      // Increase visibility level
      editor.type(keyConstants.INCREASE_LABEL_VISIBILITY);
      await waitForSuccess(() => {
        assertNewMarkers(orig, _slice.call(errorLayer.children),
                         "increasing the level");
      });
    });
开发者ID:lddubeau,项目名称:wed,代码行数:27,代码来源:wed-validation-error-test.ts

示例2: getAttributeValuesFor

     () => {
       // Text node inside title.
       const p = ps[8];
       const initial = getAttributeValuesFor(p)[0].firstChild as Text;
       caretManager.setCaret(initial, 3);
       assert.equal(initial.data, "abc");
       editor.type(keyConstants.BACKSPACE);
       editor.type(keyConstants.BACKSPACE);
       editor.type(keyConstants.BACKSPACE);

       // We have to refetch because the decorations have been redone.
       let laterValue = getAttributeValuesFor(p)[0];
       assert.isTrue((laterValue.firstChild as Element)
                     .classList.contains("_placeholder"));
       assert.equal(laterValue.childNodes.length, 1);
       caretCheck(editor, laterValue.firstChild!, 0, "caret after deletion");

       // Check that the data is also modified
       let dataNode = editor.toDataNode(laterValue) as Attr;
       assert.equal(dataNode.value, "");

       // Overdeleting
       editor.type(keyConstants.BACKSPACE);

       laterValue = getAttributeValuesFor(p)[0];
       assert.isTrue((laterValue.firstChild as Element)
                     .classList.contains("_placeholder"));
       assert.equal(laterValue.childNodes.length, 1);
       caretCheck(editor, laterValue.firstChild!, 0, "caret after deletion");

       // Check that the data is also modified
       dataNode = editor.toDataNode(laterValue) as Attr;
       assert.equal(dataNode.value, "");
     });
开发者ID:lddubeau,项目名称:wed,代码行数:34,代码来源:wed-typing-test.ts

示例3: it

 it("searches forward", () => {
   editor.type(QUICKSEARCH_FORWARD);
   editor.type("abc", WedEventTarget.MINIBUFFER);
   checkHighlightRanges(firstABCText);
   editor.type(QUICKSEARCH_FORWARD, WedEventTarget.MINIBUFFER);
   checkHighlightRanges(pFiveFirstThree);
   editor.type(ESCAPE, WedEventTarget.MINIBUFFER);
 });
开发者ID:lddubeau,项目名称:wed,代码行数:8,代码来源:quick-search-test.ts

示例4: it

  it("modification status shows an unmodified document after save", () => {
    // Text node inside title.
    const initial = titles[0].childNodes[1];
    caretManager.setCaret(initial, 0);
    editor.type(" ");

    assert.isTrue($modificationStatus.hasClass("label-warning"));
    editor.type(keyConstants.SAVE);
    return waitForSuccess(() => {
      assert.isTrue($modificationStatus.hasClass("label-success"));
    });
  });
开发者ID:lddubeau,项目名称:wed,代码行数:12,代码来源:wed-file-state-test.ts

示例5: it

 it("that takes completions", () => {
   const p = ps[9];
   const attrVals = getAttributeValuesFor(p);
   caretManager.setCaret(attrVals[0].firstChild, 0);
   contextMenuHasOption(editor, /^Y$/);
   editor.type("Y");
   // The context menu should be gone.
   const menu = editor.window.document.
     getElementsByClassName("wed-context-menu")[0];
   assert.isUndefined(menu, "the menu should not exist");
   editor.type(keyConstants.REPLACEMENT_MENU);
   contextMenuHasOption(editor, /^Y$/);
 });
开发者ID:lddubeau,项目名称:wed,代码行数:13,代码来源:wed-menu-test.ts

示例6: it

  it("typing multiple spaces in an attribute normalizes the space", () => {
    // Text node inside title.
    let initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
    caretManager.setCaret(initial, 0);
    assert.equal(initial.data, "rend_value");

    editor.type(" ");

    // We have to refetch because the decorations have been redone.
    initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
    assert.equal(initial.data, " rend_value");
    caretCheck(editor, initial, 1, "caret after text insertion");

    // Check that the data is also modified
    const dataNode = editor.toDataNode(initial) as Attr;
    assert.equal(dataNode.value, " rend_value");

    editor.type(" ");

    // We have to refetch because the decorations have been redone.
    initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
    assert.equal(initial.data, " rend_value");
    caretCheck(editor, initial, 1, "caret after text insertion");

    // Check that the data is also modified
    assert.equal(dataNode.value, " rend_value");

    caretManager.setCaret(initial, 11);

    editor.type(" ");

    // We have to refetch because the decorations have been redone.
    initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
    assert.equal(initial.data, " rend_value ");
    caretCheck(editor, initial, 12, "caret after text insertion");

    // Check that the data is also modified
    assert.equal(dataNode.value, " rend_value ");

    editor.type(" ");

    // We have to refetch because the decorations have been redone.
    initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
    assert.equal(initial.data, " rend_value ");
    caretCheck(editor, initial, 12, "caret after text insertion");

    // Check that the data is also modified
    assert.equal(dataNode.value, " rend_value ");
  });
开发者ID:lddubeau,项目名称:wed,代码行数:49,代码来源:wed-typing-test.ts

示例7: it

    it("searches attributes", () => {
      editor.type(SEARCH_FORWARD);

      clickAttributes();
      typeInSearch("abc");
      checkHighlightRanges(firstABCAttribute);
    });
开发者ID:lddubeau,项目名称:wed,代码行数:7,代码来源:dialog-search-replace-test.ts


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