Sha256: 9ef6d18d0664346eee8ad6923a8445d9024a4e1d49d9a61152284273c34b770d

Contents?: true

Size: 1.09 KB

Versions: 13

Compression:

Stored size: 1.09 KB

Contents

/*global buster, assert, dome, gts*/

buster.testCase("Live markdown preview", {
    setUp: function () {
        var el = dome.el("div", [
            dome.el("textarea"),
            dome.el("div", { id: "target" }, [dome.el("div")])
        ]);

        document.body.appendChild(el);
        this.textarea = el.firstChild;
        this.textarea.setAttribute("data-gts-preview-target", "target");
        this.target = el.lastChild.firstChild;
        this.clock = this.useFakeTimers();
    },

    "renders markdown as html in div": function () {
        gts.liveMarkdownPreview(this.textarea);
        this.textarea.innerHTML = "*hey*";

        this.clock.tick(50);

        assert.match(this.target.innerHTML, "<em>hey</em>");
    },

    "updates rendered html": function () {
        gts.liveMarkdownPreview(this.textarea);
        this.textarea.innerHTML = "*hey*";
        this.clock.tick(50);

        this.textarea.innerHTML = "# OH!";
        this.clock.tick(50);

        refute.match(this.target.innerHTML, "<em>hey</em>");
        assert.match(this.target.innerHTML, /<h1.*>OH!<\/h1>/);
    }
});

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
dolt-0.29.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.28.1 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.28.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.27.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.26.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.25.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.24.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.23.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.22.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.21.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.20.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.19.0 vendor/ui/js/test/components/live-markdown-preview-test.js
dolt-0.18.0 vendor/ui/js/test/components/live-markdown-preview-test.js