本文整理汇总了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);
});