Sha256: 60a29b8d78c781dab53712118e92766936423f551749f9c89637abadfc4be285

Contents?: true

Size: 1.54 KB

Versions: 13

Compression:

Stored size: 1.54 KB

Contents

/*global buster, assert, refute, jQuery, gts*/
buster.testCase("Commit linker", {
    setUp: function () {
        this.el = document.createElement("div");
        // Required for even triggering to work properly
        document.body.appendChild(this.el);
    },

    "triggers handler for gts-commit-oid link": function () {
        var cb = this.spy();
        this.el.innerHTML = "<span class=\"gts-commit-oid\" " +
            "data-gts-commit-oid=\"master\">master</span>";

        gts.commitLinker(this.el, "/gitorious/mainline/commit/#{oid}", cb);
        jQuery(this.el.firstChild).trigger("click");

        assert.calledOnceWith(cb, "/gitorious/mainline/commit/master");
    },

    "does not trigger handler for regular link": function () {
        var cb = this.spy();
        this.el.innerHTML = "<span>master</span>";

        gts.commitLinker(this.el, "/gitorious/mainline/commit/#{oid}", cb);
        jQuery(this.el.firstChild).trigger("click");

        refute.called(cb);
    },

    "triggers handler for link added later": function () {
        var cb = this.spy();

        gts.commitLinker(this.el, "/gitorious/mainline/commit/#{oid}", cb);
        this.el.innerHTML = "<span class=\"gts-commit-oid\" " +
            "data-gts-commit-oid=\"master\">master</span>";
        jQuery(this.el.firstChild).trigger("click");

        assert.calledOnce(cb);
    },

    "adds class name to root element": function () {
        gts.commitLinker(this.el, "/gitorious/mainline/commit/#{oid}");

        assert.className(this.el, "gts-commit-linker");
    }
});

Version data entries

13 entries across 13 versions & 1 rubygems

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