Sha256: 91b21958730d2d283ba64cde52cc0d57e631f2ff80504b9238386a36eab18e23

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

import { selectContent } from "../../helpers";

import contextHelpers from "./context";

export default (ctx) => {
  const { getControl, setContent } = contextHelpers(ctx);

  describe("codeBlock", () => {
    it("creates a new code block", async () => {
      await setContent("Hello, world!");
      selectContent(ctx.prosemirror);
      getControl("codeBlock").click();

      expect(ctx.prosemirror.innerHTML).toEqual("<pre><code>Hello, world!</code></pre>");
    });

    it("makes existing code block content as normal text", async () => {
      await setContent("<pre><code>Hello, world!</code></pre>");

      selectContent(ctx.prosemirror, "pre code");
      getControl("codeBlock").click();

      expect(ctx.prosemirror.innerHTML).toEqual("<p>Hello, world!</p>");
    });
  });

  describe("blockquote", () => {
    it("creates a new blockquote", async () => {
      await setContent("Hello, world!");
      selectContent(ctx.prosemirror);
      getControl("blockquote").click();

      expect(ctx.prosemirror.innerHTML).toEqual("<blockquote><p>Hello, world!</p></blockquote>");
    });

    it("makes existing blockquote content as normal text", async () => {
      await setContent("<blockquote><p>Hello, world!</p></blockquote>");

      selectContent(ctx.prosemirror, "blockquote p");
      getControl("blockquote").click();

      expect(ctx.prosemirror.innerHTML).toEqual("<p>Hello, world!</p>");
    });
  });
};

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.28.0 app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js
decidim-core-0.28.0.rc5 app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js
decidim-core-0.28.0.rc4 app/packs/src/decidim/editor/test/toolbar/shared/behaves_like_basic_block.js