本文整理匯總了TypeScript中@rich-editor/__tests__/OpUtils.op函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript op函數的具體用法?TypeScript op怎麽用?TypeScript op使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了op函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
.forEach(({ op, name }) => {
const one = OpUtils.op("1");
const two = OpUtils.op("2");
const three = OpUtils.op("3");
const initial = [one, op, two, op, three, op];
it(`can apply the ${lineFormatName} format to the 1st line of 3 lines of the ${name} format`, () => {
const expected = [one, lineOp, two, op, three, op];
const range: RangeStatic = { index: 0, length: 0 };
const formatterFunction = () => format(range);
assertQuillInputOutput(initial, expected, formatterFunction);
});
it(`can apply the ${lineFormatName} format to the 2nd line of 3 lines of the ${name} format`, () => {
const expected = [one, op, two, lineOp, three, op];
const range: RangeStatic = { index: 2, length: 0 };
const formatterFunction = () => format(range);
assertQuillInputOutput(initial, expected, formatterFunction);
});
it(`can apply the ${lineFormatName} format to the 3rd line of 3 lines of the ${name} format`, () => {
const expected = [one, op, two, op, three, lineOp];
const range: RangeStatic = { index: 4, length: 0 };
const formatterFunction = () => format(range);
assertQuillInputOutput(initial, expected, formatterFunction);
});
});
示例2: it
it("can have it's format replaced", () => {
insertListBlot({ type: ListType.BULLETED, depth: 0 }, "1");
insertListBlot({ type: ListType.BULLETED, depth: 1 }, "1.1");
insertListBlot({ type: ListType.BULLETED, depth: 1 }, "1.2");
quill.formatLine(0, 1, ListItem.blotName, false, Quill.sources.USER);
expect(quill.getContents().ops).deep.eq([
OpUtils.op("1\n1.1"),
OpUtils.list(ListType.BULLETED),
OpUtils.op("1.2"),
OpUtils.list(ListType.BULLETED),
]);
});
示例3: it
it("can paste it's own type of list blot", () => {
const ops = [
OpUtils.op("Line 1"),
OpUtils.list(ListType.BULLETED, 0),
OpUtils.op("Line 1.1"),
OpUtils.list(ListType.ORDERED, 1),
OpUtils.op("Line 1.1.1"),
OpUtils.list(ListType.BULLETED, 2),
OpUtils.op("Line 1.1.1.1"),
OpUtils.list(ListType.ORDERED, 3),
];
quill.setContents(ops);
const html = quill.scroll.domNode.innerHTML;
reset();
clipboard.dangerouslyPasteHTML(html);
expect(quill.getContents().ops).deep.eq(ops);
});