當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript OpUtils.op函數代碼示例

本文整理匯總了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);
                    });
                });
開發者ID:vanilla,項目名稱:vanilla,代碼行數:27,代碼來源:Formatter.test.ts

示例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),
            ]);
        });
開發者ID:vanilla,項目名稱:vanilla,代碼行數:13,代碼來源:ListBlot.test.ts

示例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);
            });
開發者ID:vanilla,項目名稱:vanilla,代碼行數:18,代碼來源:ClipboardModule.test.ts


注:本文中的@rich-editor/__tests__/OpUtils.op函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。