diff --git a/jasmine/jasmine.headless-reporter.coffee b/jasmine/jasmine.headless-reporter.coffee index b759f64..45ec549 100644 --- a/jasmine/jasmine.headless-reporter.coffee +++ b/jasmine/jasmine.headless-reporter.coffee @@ -13,8 +13,7 @@ class window.HeadlessReporterResult JHW.printName(output) for result in @results - do (result) => - JHW.printResult(result) + JHW.printResult(result) _findSpecLine: -> bestChoice = { accuracy: 0, file: null, lineNumber: null } @@ -56,8 +55,7 @@ class jasmine.HeadlessReporter @length = 0 reportRunnerResults: (runner) -> for result in @results - do (result) => - result.print() + result.print() this.callback() if @callback JHW.finishSuite((new Date() - @startTime) / 1000.0, @length, @failedCount) @@ -73,9 +71,8 @@ class jasmine.HeadlessReporter @failedCount++ failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName()) for result in results.getItems() - do (result) => - if result.type == 'expect' and !result.passed_ - failureResult.addResult(result.message) + if result.type == 'expect' and !result.passed_ + failureResult.addResult(result.message) @results.push(failureResult) reportSpecStarting: (spec) -> reportSuiteResults: (suite) -> diff --git a/jasmine/jasmine.headless-reporter.js b/jasmine/jasmine.headless-reporter.js index 53f2be2..b95b23c 100644 --- a/jasmine/jasmine.headless-reporter.js +++ b/jasmine/jasmine.headless-reporter.js @@ -1,5 +1,4 @@ (function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; if (!(typeof jasmine !== "undefined" && jasmine !== null)) { throw new Error("jasmine not laoded!"); } @@ -24,9 +23,7 @@ _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { result = _ref[_i]; - _results.push(__bind(function(result) { - return JHW.printResult(result); - }, this)(result)); + _results.push(JHW.printResult(result)); } return _results; }; @@ -90,14 +87,11 @@ this.length = 0; } HeadlessReporter.prototype.reportRunnerResults = function(runner) { - var result, _fn, _i, _len, _ref; + var result, _i, _len, _ref; _ref = this.results; - _fn = __bind(function(result) { - return result.print(); - }, this); for (_i = 0, _len = _ref.length; _i < _len; _i++) { result = _ref[_i]; - _fn(result); + result.print(); } if (this.callback) { this.callback(); @@ -108,7 +102,7 @@ return this.startTime = new Date(); }; HeadlessReporter.prototype.reportSpecResults = function(spec) { - var failureResult, result, results, _fn, _i, _len, _ref; + var failureResult, result, results, _i, _len, _ref; results = spec.results(); this.length++; if (results.passed()) { @@ -118,14 +112,11 @@ this.failedCount++; failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName()); _ref = results.getItems(); - _fn = __bind(function(result) { - if (result.type === 'expect' && !result.passed_) { - return failureResult.addResult(result.message); - } - }, this); for (_i = 0, _len = _ref.length; _i < _len; _i++) { result = _ref[_i]; - _fn(result); + if (result.type === 'expect' && !result.passed_) { + failureResult.addResult(result.message); + } } return this.results.push(failureResult); } diff --git a/spec/bin/jasmine-headless-webkit_spec.rb b/spec/bin/jasmine-headless-webkit_spec.rb index c40590d..d079c93 100644 --- a/spec/bin/jasmine-headless-webkit_spec.rb +++ b/spec/bin/jasmine-headless-webkit_spec.rb @@ -69,6 +69,15 @@ describe "jasmine-headless-webkit" do end end + describe 'tries to click a button' do + it "should not leave the page nor loop" do + system %{bin/jasmine-headless-webkit -j spec/jasmine/click_button/click_button.yml --report #{report}} + $?.exitstatus.should == 1 + + report.should be_a_report_containing(2, 0, false) + end + end + describe 'with filtered run' do context "don't run a full run, just the filtered run" do it "should succeed and run both" do diff --git a/spec/jasmine/click_button/click_button.js b/spec/jasmine/click_button/click_button.js new file mode 100644 index 0000000..6c2afd0 --- /dev/null +++ b/spec/jasmine/click_button/click_button.js @@ -0,0 +1,5 @@ +function yes() { + $('body').append('