o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1371407758.9892879: @value")G{I" class:EFI"BundledAsset;FI"logical_path;FI")teaspoon/base/reporters/html_spec.js;TI" pathname;FI"_/Users/jejacks0n/Projects/teabag/spec/javascripts/teaspoon/base/reporters/html_spec.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-06-16T11:48:01-06:00;FI" length;Fi5EI" digest;F"%839b90f48c01aacac8abf52c66b4f125I" source;FI"5E(function() { describe("Teaspoon.Reporters.HTML", function() { beforeEach(function() { var _this = this; this.originalParams = Teaspoon.params; this.buildSpy = spyOn(Teaspoon.Reporters.HTML.prototype, "build"); this.readConfigSpy = spyOn(Teaspoon.Reporters.HTML.prototype, "readConfig"); Teaspoon.params = { grep: "foo" }; this.reporter = new Teaspoon.Reporters.HTML(); this.jasmineSuite = { getFullName: function() { return "_full jasmine suite description_"; } }; this.jasmineSpecResultsItems = [ { message: "_jasmine_message1_", trace: { stack: "_jasmine_stack_trace1_" }, passed: function() { return false; } }, { message: "_jasmine_message2_", trace: { stack: "_jasmine_stack_trace2_" }, passed: function() { return false; } } ]; this.jasmineSpecResults = { skipped: false, passed: function() { return true; }, getItems: function() { return _this.jasmineSpecResultsItems; } }; return this.jasmineSpec = { description: "_jasmine_description_", viewId: 42, pending: false, suite: this.jasmineSuite, getFullName: function() { return "_full jasmine description_"; }, results: function() { return _this.jasmineSpecResults; } }; }); afterEach(function() { return Teaspoon.params = this.originalParams; }); describe("constructor", function() { it("sets up the expected variables", function() { expect(this.reporter.start).toBeDefined(); expect(this.reporter.config).toEqual({ "use-catch": true, "build-full-report": false, "display-progress": true }); expect(this.reporter.total).toEqual({ exist: 0, run: 0, passes: 0, failures: 0, skipped: 0 }); expect(this.reporter.views).toEqual({ specs: {}, suites: {} }); return expect(this.reporter.filters).toEqual(["remove by match: foo"]); }); return it("calls readConfig", function() { return expect(this.readConfigSpy).toHaveBeenCalled(); }); }); describe("#build", function() { beforeEach(function() { this.el = {}; this.buildSpy.andCallThrough(); this.buildLayoutSpy = spyOn(this.reporter, "buildLayout"); this.findElSpy = spyOn(this.reporter, "findEl").andReturn(this.el); this.setTextSpy = spyOn(this.reporter, "setText"); this.showConfigurationSpy = spyOn(this.reporter, "showConfiguration"); this.buildProgressSpy = spyOn(this.reporter, "buildProgress"); this.buildSuiteSelectSpy = spyOn(this.reporter, "buildSuiteSelect"); this.buildFiltersSpy = spyOn(this.reporter, "buildFilters"); spyOn(this.reporter, "envInfo").andReturn("library 1.0.0"); return this.reporter.build(); }); it("calls buildLayout", function() { return expect(this.buildLayoutSpy).toHaveBeenCalled(); }); it("finds the element and assigns it", function() { expect(this.findElSpy).toHaveBeenCalledWith("report-all"); return expect(this.reporter.el).toBe(this.el); }); it("sets the env-info and version", function() { expect(this.setTextSpy).toHaveBeenCalledWith("env-info", "library 1.0.0"); return expect(this.setTextSpy).toHaveBeenCalledWith("version", Teaspoon.version); }); it("makes the toggles clickable", function() { expect(this.findElSpy).toHaveBeenCalledWith("toggles"); return expect(this.el.onclick).toBe(this.reporter.toggleConfig); }); it("calls showConfiguration", function() { return expect(this.showConfigurationSpy).toHaveBeenCalled(); }); it("calls buildProgress", function() { return expect(this.buildProgressSpy).toHaveBeenCalled(); }); it("calls buildSuiteSelect", function() { return expect(this.buildSuiteSelectSpy).toHaveBeenCalled(); }); return it("calls buildFilters", function() { return expect(this.buildFiltersSpy).toHaveBeenCalled(); }); }); describe("#buildLayout", function() { beforeEach(function() { this.el = {}; this.createElSpy = spyOn(this.reporter, "createEl").andReturn(this.el); this.appendChildSpy = spyOn(document.body, "appendChild"); return this.reporter.buildLayout(); }); return it("creates an element and appends it to the body", function() { expect(this.createElSpy).toHaveBeenCalledWith("div"); expect(this.appendChildSpy).toHaveBeenCalledWith(this.el); return expect(this.el.innerHTML).toContain("Teaspoon"); }); }); describe("#buildSuiteSelect", function() { beforeEach(function() { this.originalSuites = Teaspoon.suites; return Teaspoon.suites = { all: ["default", "foo", "bar"], active: "foo" }; }); afterEach(function() { return Teaspoon.suites = this.originalSuites; }); return it("builds a select that displays the suites", function() { var result; result = this.reporter.buildSuiteSelect(); expect(result).toContain("select id="); return expect(result).toContain("selected='selected' value=\"foo\""); }); }); describe("#buildProgress", function() { beforeEach(function() { this.progress = { appendTo: function() {} }; this.findElSpy = spyOn(this.reporter, "findEl").andReturn("_element_"); this.createSpy = spyOn(Teaspoon.Reporters.HTML.ProgressView, "create").andReturn(this.progress); this.appendToSpy = spyOn(this.progress, "appendTo"); return this.reporter.buildProgress(); }); it("calls create on ProgressView", function() { return expect(this.createSpy).toHaveBeenCalledWith(true); }); return it("appends the progress element to the dom", function() { return expect(this.appendToSpy).toHaveBeenCalledWith("_element_"); }); }); describe("#reportRunnerStarting", function() { beforeEach(function() { this.setTextSpy = spyOn(this.reporter, "setText"); return this.reporter.reportRunnerStarting({ total: 42 }); }); it("gets the totals", function() { return expect(this.reporter.total.exist).toBe(42); }); return it("sets the duration text", function() { return expect(this.setTextSpy).toHaveBeenCalledWith("stats-duration", "..."); }); }); describe("#reportSpecStarting", function() { it("creates a SpecView", function() { var spy; this.reporter.config["build-full-report"] = true; spy = spyOn(Teaspoon.Reporters.HTML, "SpecView"); this.reporter.reportSpecStarting(this.jasmineSpec); return expect(spy).toHaveBeenCalled(); }); it("doesn't create the SpecView if we're not building the full report", function() { var spy; this.reporter.config["build-full-report"] = false; spy = spyOn(Teaspoon.Reporters.HTML, "SpecView"); this.reporter.reportSpecStarting(this.jasmineSpec); return expect(spy).wasNotCalled(); }); return it("tracks the start time of the spec", function() { this.reporter.specStart = void 0; this.reporter.reportSpecStarting(this.jasmineSpec); return expect(this.reporter.specStart).toBeDefined(); }); }); describe("#reportSpecResults", function() { beforeEach(function() { this.updateProgressSpy = spyOn(this.reporter, "updateProgress"); return this.updateStatusSpy = spyOn(this.reporter, "updateStatus"); }); it("increases the total run count", function() { this.reporter.total.run = 41; this.reporter.reportSpecResults(this.jasmineSpec); return expect(this.reporter.total.run).toBe(42); }); it("calls updateProgress", function() { this.reporter.reportSpecResults(this.jasmineSpec); return expect(this.updateProgressSpy).toHaveBeenCalled(); }); return it("calls updateStatus", function() { this.reporter.reportSpecResults(this.jasmineSpec); return expect(this.updateStatusSpy).toHaveBeenCalledWith(this.jasmineSpec); }); }); describe("#reportRunnerResults", function() { beforeEach(function() { this.setTextSpy = spyOn(this.reporter, "setText"); this.setStatusSpy = spyOn(this.reporter, "setStatus"); this.updateProgressSpy = spyOn(this.reporter, "updateProgress"); this.elapsedTimeSpy = spyOn(this.reporter, "elapsedTime").andReturn("1.000s"); return this.reporter.total = { run: 666, exist: 42, failures: 5, passes: 10, skipped: 15 }; }); it("does nothing if there were no tests run", function() { this.reporter.total.run = 0; this.reporter.reportRunnerResults(); return expect(this.setTextSpy).wasNotCalled(); }); it("sets the duration text", function() { this.reporter.total = { run: 666, exist: 42 }; this.reporter.reportRunnerResults(); return expect(this.setTextSpy).toHaveBeenCalledWith("stats-duration", "1.000s"); }); it("sets the status to passed if there are no failures", function() { this.reporter.total.failures = 0; this.reporter.reportRunnerResults(); return expect(this.setStatusSpy).toHaveBeenCalledWith("passed"); }); it("displays the total passes", function() { this.reporter.reportRunnerResults(); return expect(this.setTextSpy).toHaveBeenCalledWith("stats-passes", 10); }); it("displays the total failures", function() { this.reporter.reportRunnerResults(); return expect(this.setTextSpy).toHaveBeenCalledWith("stats-failures", 5); }); it("displays the total skipped", function() { this.reporter.reportRunnerResults(); return expect(this.setTextSpy).toHaveBeenCalledWith("stats-skipped", 15); }); return it("calls updateProgress", function() { this.reporter.reportRunnerResults(); return expect(this.updateProgressSpy).toHaveBeenCalled(); }); }); describe("#updateStat", function() { beforeEach(function() { return this.setTextSpy = spyOn(this.reporter, "setText"); }); it("does nothing if we're not displaying progress", function() { this.reporter.config["display-progress"] = false; this.reporter.updateStat("name", 42); return expect(this.setTextSpy).wasNotCalled(); }); return it("sets the text of the stat we want to set", function() { this.reporter.updateStat("name", 42); return expect(this.setTextSpy).toHaveBeenCalledWith("stats-name", 42); }); }); describe("#updateStatus", function() { beforeEach(function() { this.updateStatSpy = spyOn(this.reporter, "updateStat"); this.setStatusSpy = spyOn(this.reporter, "setStatus"); return this.findElSpy = spyOn(this.reporter, "findEl").andReturn({ appendChild: function() {} }); }); describe("skipped", function() { return it("updates the statistic", function() { this.jasmineSpecResults.skipped = true; this.reporter.updateStatus(this.jasmineSpec); return expect(this.updateStatSpy).toHaveBeenCalledWith("skipped", 1); }); }); describe("pass", function() { it("updates the statistic", function() { this.reporter.updateStatus(this.jasmineSpec); return expect(this.updateStatSpy).toHaveBeenCalledWith("passes", 1); }); return it("calls updateState on the view", function() { var spy; this.reporter.reportView = { updateState: function() {} }; spy = spyOn(this.reporter.reportView, "updateState"); this.reporter.updateStatus(this.jasmineSpec); return expect(spy.argsForCall[0][0]).toBe("passed"); }); }); return describe("failure", function() { beforeEach(function() { return this.jasmineSpecResults.passed = function() { return false; }; }); it("updates the statistic", function() { this.reporter.updateStatus(this.jasmineSpec); return expect(this.updateStatSpy).toHaveBeenCalledWith("failures", 1); }); it("calls updateState on the view", function() { var spy; this.reporter.reportView = { updateState: function() {} }; spy = spyOn(this.reporter.reportView, "updateState"); this.reporter.updateStatus(this.jasmineSpec); return expect(spy.argsForCall[0][0]).toBe("failed"); }); it("creates a FailureView and appends it to the dom", function() { var spy; spy = spyOn(Teaspoon.Reporters.HTML, "FailureView").andReturn({ appendTo: function() {} }); this.reporter.updateStatus(this.jasmineSpec); return expect(spy).toHaveBeenCalled(); }); it("doesn't create a FailureView if we're building the full report", function() { var spy; this.reporter.config["build-full-report"] = true; spy = spyOn(Teaspoon.Reporters.HTML, "FailureView").andReturn({ appendTo: function() {} }); this.reporter.updateStatus(this.jasmineSpec); return expect(spy).wasNotCalled(); }); return it("sets the status", function() { this.reporter.updateStatus(this.jasmineSpec); return expect(this.setStatusSpy).toHaveBeenCalledWith("failed"); }); }); }); describe("#updateProgress", function() { beforeEach(function() { this.progress = { update: function() {} }; this.updateSpy = spyOn(this.progress, "update"); this.reporter.progress = this.progress; this.reporter.total = { exist: 666, run: 42 }; return this.reporter.updateProgress(); }); return it("calls update on the progress view", function() { return expect(this.updateSpy).toHaveBeenCalledWith(666, 42); }); }); describe("#showConfiguration", function() { beforeEach(function() { return this.setClassSpy = spyOn(this.reporter, "setClass"); }); return it("sets the class to active on the toggle buttons for each configuration", function() { this.reporter.showConfiguration(); expect(this.setClassSpy).toHaveBeenCalledWith("use-catch", "active"); expect(this.setClassSpy).toHaveBeenCalledWith("build-full-report", ""); return expect(this.setClassSpy).toHaveBeenCalledWith("display-progress", "active"); }); }); describe("#setStatus", function() { return it("sets the body class to the status passed in", function() { var current; current = document.body.className; this.reporter.setStatus("foo"); expect(document.body.className).toBe("teaspoon-foo"); return document.body.className = current; }); }); describe("#setFilter", function() { beforeEach(function() { Teaspoon.params = { grep: "_grep_", file: "_file_" }; this.reporter.filters = []; return this.reporter.setFilters(); }); return it("sets a class and the html for the filter display", function() { expect(this.reporter.filters.length).toBe(2); expect(this.reporter.filters[0]).toBe("remove by file: _file_"); return expect(this.reporter.filters[1]).toBe("remove by match: _grep_"); }); }); describe("#readConfig", function() { beforeEach(function() { this.readConfigSpy.andCallThrough(); this.config = {}; this.cookieSpy = spyOn(this.reporter, "cookie").andReturn(this.config); return this.reporter.readConfig(); }); return it("reads the configuration from the cookie", function() { expect(this.cookieSpy).toHaveBeenCalledWith("teaspoon"); return expect(this.reporter.config).toEqual(this.config); }); }); return describe("#toggleConfig", function() { beforeEach(function() { this.refreshSpy = spyOn(this.reporter, "refresh"); this.cookieSpy = spyOn(this.reporter, "cookie"); return this.reporter.toggleConfig({ target: { tagName: "button", getAttribute: function() { return "teaspoon-use-catch"; } } }); }); it("toggles the configuration", function() { return expect(this.reporter.config["use-catch"]).toBe(false); }); it("sets the cookie", function() { return expect(this.cookieSpy).toHaveBeenCalledWith("teaspoon", this.reporter.config); }); return it("refreshes the page", function() { return expect(this.refreshSpy).toHaveBeenCalled(); }); }); }); }).call(this); ;FI"required_assets_digest;F"%f24b7d0bc3774b74b74e667a9f64a75aI" _version;F"%6776f581a4329e299531e1d52aa59832