本文整理汇总了TypeScript中@rich-editor/__tests__/OpUtils.list函数的典型用法代码示例。如果您正苦于以下问题:TypeScript list函数的具体用法?TypeScript list怎么用?TypeScript list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了list函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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),
]);
});
示例2: 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);
});
示例3: testInlineAgainstLineFormatting
function testInlineAgainstLineFormatting(
formatToTest: string,
formatterFunction: () => void,
enableValue: any = true,
) {
const testAgainst = [
{
op: OpUtils.spoilerLine(),
name: "spoiler",
},
{ op: OpUtils.quoteLine(), name: "quote" },
{ op: OpUtils.heading(2), name: "h2" },
{ op: OpUtils.heading(3), name: "h3" },
{ op: OpUtils.list(ListType.ORDERED), name: "ordered list" },
{ op: OpUtils.list(ListType.BULLETED), name: "bulleted list" },
];
describe(`Add ${formatToTest} to line formats`, () => {
testAgainst.forEach(({ op, name }) => {
it(name + " + " + formatToTest, () => {
const initial = [OpUtils.op(), op];
const finalOp = OpUtils.op();
finalOp.attributes = {
[formatToTest]: enableValue,
};
const expected = [finalOp, op];
assertQuillInputOutput(initial, expected, formatterFunction);
});
});
it("Does nothing to Code Blocks", () => {
const initial = [OpUtils.op(), OpUtils.codeBlock()];
const expected = [OpUtils.op(), OpUtils.codeBlock()];
assertQuillInputOutput(initial, expected, formatterFunction);
});
});
}
示例4: describe
describe("bulletedList()", () => {
const formattingFunction = (range?: RangeStatic) => makeFormatter(range).bulletedList();
testLineFormatInlinePreservation("bulletedList", formattingFunction, OpUtils.list(ListType.BULLETED));
testLineFormatExclusivity("bulletedList", formattingFunction, OpUtils.list(ListType.BULLETED));
testMultiLineFormatting("bulletedList", formattingFunction, OpUtils.list(ListType.BULLETED));
});
示例5: describe
describe("list items", () => {
interface ITestValue {
description?: string;
in: string;
out: DeltaOperation[];
}
const listData: ITestValue[] = [
{
in: `<li>Item 1</li>`,
out: [OpUtils.op("Item 1"), OpUtils.list(ListType.BULLETED)],
},
{
in: `<ul><li>Unordered</li></ul>`,
out: [OpUtils.op("Unordered"), OpUtils.list(ListType.BULLETED)],
},
{
in: `<ol><li>Ordered</li></ol>`,
out: [OpUtils.op("Ordered"), OpUtils.list(ListType.ORDERED)],
},
{
in: `<ul><li>Unordered</li></ul><ol><li>Ordered</li></ol>`,
out: [
OpUtils.op("Unordered"),
OpUtils.list(ListType.BULLETED),
OpUtils.op("Ordered"),
OpUtils.list(ListType.ORDERED),
],
},
{
// Nesting same list type
in: `
<ul>
<li>
Line 1
<ul>
<li>Line 1.1</li>
<li>Line 1.2</li>
</ul>
</li>
<li>Line 2</li>
</ul>`,
out: [
OpUtils.op("Line 1"),
OpUtils.list(ListType.BULLETED, 0),
OpUtils.op("Line 1.1"),
OpUtils.list(ListType.BULLETED, 1),
OpUtils.op("Line 1.2"),
OpUtils.list(ListType.BULLETED, 1),
OpUtils.op("Line 2"),
OpUtils.list(ListType.BULLETED, 0),
],
},
{
// Nesting different list types
in: `
<ul>
<li>
Line 1
<ol>
<li>Line 1.1</li>
<li>Line 1.2</li>
</ol>
</li>
<li>Line 2</li>
</ul>`,
out: [
OpUtils.op("Line 1"),
OpUtils.list(ListType.BULLETED, 0),
OpUtils.op("Line 1.1"),
OpUtils.list(ListType.ORDERED, 1),
OpUtils.op("Line 1.2"),
OpUtils.list(ListType.ORDERED, 1),
OpUtils.op("Line 2"),
OpUtils.list(ListType.BULLETED, 0),
],
},
{
description: "Nesting very deep lists of the same type",
in: `
<ul>
<li>
Line 1
<ul>
<li>
Line 1.1
<ul>
<li>
Line 1.1.1
<ul>
<li>Line 1.1.1.1</li>
</ul
</li>
</ul>
</li>
</ul>
</li>
</ul>`,
out: [
OpUtils.op("Line 1"),
OpUtils.list(ListType.BULLETED, 0),
//.........这里部分代码省略.........