app/assets/javascripts/teabag-jasmine.js in teabag-0.4.0 vs app/assets/javascripts/teabag-jasmine.js in teabag-0.4.1

- old
+ new

@@ -2608,11 +2608,11 @@ Teabag.defer = false; Teabag.slow = 75; - Teabag.fixturePath = null; + Teabag.root = null; Teabag.finished = false; Teabag.Reporters = {}; @@ -2659,11 +2659,11 @@ function Runner() { if (this.constructor.run) { return; } this.constructor.run = true; - this.fixturePath = Teabag.fixturePath; + this.fixturePath = "" + Teabag.root + "/fixtures"; this.params = this.getParams(); this.setup(); } Runner.prototype.getParams = function() { @@ -2810,21 +2810,36 @@ this.buildLayout(); this.el = this.findEl("report-all"); this.setText("env-info", this.envInfo()); this.setText("version", Teabag.version); this.findEl("toggles").onclick = this.toggleConfig; + this.findEl("suite-select").onchange = this.changeSuite; this.showConfiguration(); return this.buildProgress(); }; HTML.prototype.buildLayout = function() { var el; el = this.createEl("div"); document.body.appendChild(el); - return el.innerHTML = "<div class=\"teabag-clearfix\">\n <div id=\"teabag-title\">\n <h1>Teabag</h1>\n <ul>\n <li>version: <b id=\"teabag-version\"></b></li>\n <li id=\"teabag-env-info\"></li>\n </ul>\n </div>\n <div id=\"teabag-progress\"></div>\n <ul id=\"teabag-stats\">\n <li>passes: <b id=\"teabag-stats-passes\">0</b></li>\n <li>failures: <b id=\"teabag-stats-failures\">0</b></li>\n <li>skipped: <b id=\"teabag-stats-skipped\">0</b></li>\n <li>duration: <b id=\"teabag-stats-duration\">&infin;</b></li>\n </ul>\n</div>\n\n<div id=\"teabag-controls\" class=\"teabag-clearfix\">\n <div id=\"teabag-toggles\">\n <button id=\"teabag-use-catch\">Use Try/Catch</button>\n <button id=\"teabag-build-full-report\">Build Full Report</button>\n <button id=\"teabag-display-progress\">Display Progress</button>\n </div>\n <div id=\"teabag-filtered\">\n <button onclick=\"window.location.href = window.location.pathname\">Run All Specs</button>\n </div>\n</div>\n\n<hr/>\n\n<div id=\"teabag-report\">\n <ol id=\"teabag-report-failures\"></ol>\n <ol id=\"teabag-report-all\"></ol>\n</div>"; + return el.innerHTML = "<div class=\"teabag-clearfix\">\n <div id=\"teabag-title\">\n <h1>Teabag</h1>\n <ul>\n <li>version: <b id=\"teabag-version\"></b></li>\n <li id=\"teabag-env-info\"></li>\n </ul>\n </div>\n <div id=\"teabag-progress\"></div>\n <ul id=\"teabag-stats\">\n <li>passes: <b id=\"teabag-stats-passes\">0</b></li>\n <li>failures: <b id=\"teabag-stats-failures\">0</b></li>\n <li>skipped: <b id=\"teabag-stats-skipped\">0</b></li>\n <li>duration: <b id=\"teabag-stats-duration\">&infin;</b></li>\n </ul>\n</div>\n\n<div id=\"teabag-controls\" class=\"teabag-clearfix\">\n <div id=\"teabag-toggles\">\n <button id=\"teabag-use-catch\" title=\"Toggle using try/catch wrappers when possible\">Try/Catch</button>\n <button id=\"teabag-build-full-report\" title=\"Toggle building the full report\">Full Report</button>\n <button id=\"teabag-display-progress\" title=\"Toggle displaying progress as tests run\">Progress</button>\n </div>\n <div id=\"teabag-filter\">\n " + (this.buildSuiteSelect()) + "\n <button onclick=\"window.location.href = window.location.pathname\">Run All</button>\n <span id=\"teabag-filter-info\">\n </div>\n</div>\n\n<hr/>\n\n<div id=\"teabag-report\">\n <ol id=\"teabag-report-failures\"></ol>\n <ol id=\"teabag-report-all\"></ol>\n</div>"; }; + HTML.prototype.buildSuiteSelect = function() { + var options, suite, _i, _len, _ref; + if (Teabag.suites.all.length === 1) { + return ""; + } + options = []; + _ref = Teabag.suites.all; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + suite = _ref[_i]; + options.push("<option" + (Teabag.suites.active === suite ? " selected='selected'" : "") + " value=\"" + suite + "\">" + suite + " suite</option>"); + } + return "<select id=\"teabag-suite-select\">" + (options.join("")) + "</select>"; + }; + HTML.prototype.buildProgress = function() { this.progress = Teabag.Reporters.HTML.ProgressView.create(this.config["display-progress"]); return this.progress.appendTo(this.findEl("progress")); }; @@ -2923,12 +2938,12 @@ HTML.prototype.setFilter = function(filter) { if (!filter) { return; } - this.setClass("filtered", "teabag-filtered"); - return this.setHtml("filtered", "" + filter, true); + this.setClass("filter", "teabag-filtered"); + return this.setHtml("filter-info", "" + filter, true); }; HTML.prototype.readConfig = function() { var config; if (config = this.cookie("teabag")) { @@ -2944,9 +2959,13 @@ } name = button.getAttribute("id").replace(/^teabag-/, ""); this.config[name] = !this.config[name]; this.cookie("teabag", this.config); return this.refresh(); + }; + + HTML.prototype.changeSuite = function() { + return window.location.href = "/teabag/" + this.options[this.options.selectedIndex].value; }; HTML.prototype.refresh = function() { return window.location.href = window.location.href; };