Example #1
0
        it("will place focus on a FocusableEmbedBlot if it is the first element in the editor", async () => {
            const embed = Parchment.create("embed-loading", stubEmbedData) as LoadingBlot;
            quill.scroll.insertBefore(embed, quill.scroll.children.tail!);
            const test = quill.insertText(quill.scroll.length(), "test");

            embedFocusModule.focusFirstLine();

            expect(embed.domNode.contains(document.activeElement) || document.activeElement === embed.domNode).eq(true);
            expect(quill.getSelection().index, "The quill selection was incorrect").eq(0);
        });
Example #2
0
        it("will place focus and selection on quill if the first element in the editor is text", async () => {
            const test = quill.insertText(0, "test");
            const embed = Parchment.create("embed-loading", stubEmbedData) as LoadingBlot;
            quill.scroll.insertBefore(embed);

            embedFocusModule.focusFirstLine();

            expect(quill.hasFocus()).eq(true);
            expect(quill.getSelection().index, "The quill selection was incorrect").eq(0);
        });