Пример #1
0
            it("can paste some images", () => {
                const html = `
                    <p><img src="/image1.png" alt="image-1"></p>
                    <img src="/image-no-alt.jpg">
                    <div class="js-embed embedResponsive" contenteditable="false">
                        <div class="embedExternal embedImage">
                            <div class="embed-focusableElement embedExternal-content" aria-label="External embed content - image" tabindex="-1">
                                <a class="embedImage-link" href="/embed-image.jpg" rel="nofollow noopener">
                                    <img class="embedImage-img" src="/embed-image.jpg" alt="image">
                                </a>
                            </div>
                        </div>
                        <span class="sr-only">Embed Description</span>
                    </div>
                `;
                clipboard.dangerouslyPasteHTML(html);

                expect(quill.getContents().ops).deep.eq([
                    OpUtils.image("/image1.png", "image-1"),
                    OpUtils.newline(),
                    OpUtils.image("/image-no-alt.jpg", null),
                    OpUtils.image("/embed-image.jpg", "image"),
                    OpUtils.newline(),
                ]);
            });
Пример #2
0
 it(`can apply the ${lineFormatName} format to multiple lines`, () => {
     const initial = [
         OpUtils.op(),
         OpUtils.newline(),
         OpUtils.op(),
         OpUtils.newline(),
         OpUtils.op(),
         OpUtils.newline(),
     ];
     const expected = [OpUtils.op(), lineOp, OpUtils.op(), lineOp, OpUtils.op(), lineOp];
     const formatterFunction = () => format(getFullRange());
     assertQuillInputOutput(initial, expected, formatterFunction);
 });
Пример #3
0
 it(opName + " + " + formatToTest, () => {
     const opMethod = OpUtils[opName] as () => any;
     const initial = [opMethod()];
     const finalOp = opMethod();
     finalOp.attributes[formatToTest] = enableValue;
     const expected = [finalOp, OpUtils.newline()];
     assertQuillInputOutput(initial, expected, formatterFunction);
 });
Пример #4
0
 it("Can format plainText", () => {
     const initial = [OpUtils.op()];
     const expected = [finalOpCreator(), OpUtils.newline()];
     assertQuillInputOutput(initial, expected, formattingFunction);
 });