本文整理汇总了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");
});
});
示例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, "");
});
示例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);
});
示例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"));
});
});
示例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$/);
});
示例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 ");
});
示例7: it
it("searches attributes", () => {
editor.type(SEARCH_FORWARD);
clickAttributes();
typeInSearch("abc");
checkHighlightRanges(firstABCAttribute);
});