move the jquery console test to the right spot
This commit is contained in:
parent
08798ff88d
commit
a18100bb71
@ -3,12 +3,5 @@ describe('console.log', function() {
|
||||
console.log("hello");
|
||||
expect(success).toEqual(1);
|
||||
});
|
||||
|
||||
it("wont eat my precious jqueries", function() {
|
||||
var d = $('<div><div id="inner">b</div></div>');
|
||||
expect(d.find('#inner').length).toBe(1);
|
||||
console.log(d.find('#inner'));
|
||||
expect(d.find('#inner').length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
13
spec/javascripts/console.log_spec.coffee
Normal file
13
spec/javascripts/console.log_spec.coffee
Normal file
@ -0,0 +1,13 @@
|
||||
describe 'console.log', ->
|
||||
it 'should not eat my precious jqueries', ->
|
||||
_log = JHW.log
|
||||
|
||||
JHW.log = ->
|
||||
|
||||
d = $('<div><div id="inner">b</div></div>');
|
||||
expect(d.find('#inner').length).toBe(1);
|
||||
console.log(d.find('#inner'));
|
||||
expect(d.find('#inner').length).toBe(1);
|
||||
|
||||
JHW.log = _log
|
||||
|
@ -1,4 +1,7 @@
|
||||
src_files: [ 'vendor/assets/coffeescripts/*.coffee' ]
|
||||
src_files:
|
||||
- 'spec/javascripts/support/jquery-1.6.2.min.js'
|
||||
- 'vendor/assets/coffeescripts/*.coffee'
|
||||
|
||||
spec_files: [ 'spec/javascripts/*_spec.coffee' ]
|
||||
src_dir: .
|
||||
spec_dir: .
|
||||
|
@ -1,13 +1,16 @@
|
||||
(function() {
|
||||
|
||||
window.HeadlessReporterResult = (function() {
|
||||
|
||||
function HeadlessReporterResult(name, splitName) {
|
||||
this.name = name;
|
||||
this.splitName = splitName;
|
||||
this.results = [];
|
||||
}
|
||||
|
||||
HeadlessReporterResult.prototype.addResult = function(message) {
|
||||
return this.results.push(message);
|
||||
};
|
||||
|
||||
HeadlessReporterResult.prototype.print = function() {
|
||||
var bestChoice, output, result, _i, _len, _ref, _results;
|
||||
output = this.name.foreground('red');
|
||||
@ -25,10 +28,15 @@
|
||||
output += (" (line ~" + (bestChoice.lineNumber + result.lineNumber) + ")").foreground('red').bright();
|
||||
}
|
||||
JHW.stdout.puts(" " + output);
|
||||
_results.push(result.line != null ? JHW.stdout.puts((" " + result.line).foreground('yellow')) : void 0);
|
||||
if (result.line != null) {
|
||||
_results.push(JHW.stdout.puts((" " + result.line).foreground('yellow')));
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
HeadlessReporterResult.findSpecLine = function(splitName) {
|
||||
var bestChoice, file, index, lastLine, line, lineNumber, lines, newLineNumberInfo, _i, _len, _ref;
|
||||
bestChoice = {
|
||||
@ -49,9 +57,7 @@
|
||||
for (_i = 0, _len = newLineNumberInfo.length; _i < _len; _i++) {
|
||||
line = newLineNumberInfo[_i];
|
||||
lastLine = line;
|
||||
if (line > lineNumber) {
|
||||
break;
|
||||
}
|
||||
if (line > lineNumber) break;
|
||||
}
|
||||
lineNumber = lastLine;
|
||||
}
|
||||
@ -67,6 +73,7 @@
|
||||
}
|
||||
return bestChoice;
|
||||
};
|
||||
|
||||
return HeadlessReporterResult;
|
||||
|
||||
})();
|
||||
}).call(this);
|
||||
|
3
vendor/assets/javascripts/intense.js
vendored
3
vendor/assets/javascripts/intense.js
vendored
@ -1,5 +1,6 @@
|
||||
(function() {
|
||||
var code, method, _ref;
|
||||
|
||||
window.Intense = {
|
||||
colors: {
|
||||
black: 0,
|
||||
@ -29,9 +30,11 @@
|
||||
},
|
||||
useColors: true
|
||||
};
|
||||
|
||||
_ref = Intense.methods;
|
||||
for (method in _ref) {
|
||||
code = _ref[method];
|
||||
String.prototype[method] = code;
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
|
@ -1,8 +1,10 @@
|
||||
(function() {
|
||||
var getSplitName, pauseAndRun;
|
||||
|
||||
if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
|
||||
throw new Error("jasmine not laoded!");
|
||||
}
|
||||
|
||||
if (window.JHW) {
|
||||
getSplitName = function(parts) {
|
||||
parts.push(String(this.description).replace(/[\n\r]/g, ' '));
|
||||
@ -98,4 +100,5 @@
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
|
@ -1,19 +1,20 @@
|
||||
(function() {
|
||||
|
||||
if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
|
||||
throw new Error("jasmine not loaded!");
|
||||
}
|
||||
|
||||
jasmine.HeadlessConsoleReporter = (function() {
|
||||
|
||||
function HeadlessConsoleReporter(callback) {
|
||||
this.callback = callback != null ? callback : null;
|
||||
this.results = [];
|
||||
this.failedCount = 0;
|
||||
this.length = 0;
|
||||
}
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportRunnerResults = function(runner) {
|
||||
var output, result, resultLine, runtime, _i, _len, _ref;
|
||||
if (this.hasError()) {
|
||||
return;
|
||||
}
|
||||
if (this.hasError()) return;
|
||||
runtime = (new Date() - this.startTime) / 1000.0;
|
||||
JHW.stdout.print("\n");
|
||||
resultLine = this._formatResultLine(runtime);
|
||||
@ -30,20 +31,18 @@
|
||||
result = _ref[_i];
|
||||
result.print();
|
||||
}
|
||||
if (window.JHW) {
|
||||
window.onbeforeunload = null;
|
||||
}
|
||||
if (window.JHW) window.onbeforeunload = null;
|
||||
return JHW.finishSuite();
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
this.startTime = new Date();
|
||||
return JHW.stdout.puts("\nRunning Jasmine specs...".bright());
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportSpecResults = function(spec) {
|
||||
var failureResult, foundLine, result, results, testCount, _i, _len, _ref;
|
||||
if (this.hasError()) {
|
||||
return;
|
||||
}
|
||||
if (this.hasError()) return;
|
||||
JHW.ping();
|
||||
results = spec.results();
|
||||
this.length++;
|
||||
@ -70,16 +69,20 @@
|
||||
return this.results.push(failureResult);
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportSpecStarting = function(spec) {
|
||||
if (this.hasError()) {
|
||||
spec.finish();
|
||||
return spec.suite.finish();
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportSuiteResults = function(suite) {};
|
||||
|
||||
HeadlessConsoleReporter.prototype.hasError = function() {
|
||||
return JHW._hasErrors;
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype._formatResultLine = function(runtime) {
|
||||
var line;
|
||||
line = [];
|
||||
@ -91,6 +94,7 @@
|
||||
line.push((runtime === 1.0 ? "sec" : "secs") + '.');
|
||||
return line.join(' ');
|
||||
};
|
||||
|
||||
return HeadlessConsoleReporter;
|
||||
|
||||
})();
|
||||
}).call(this);
|
||||
|
8
vendor/assets/javascripts/prolog.js
vendored
8
vendor/assets/javascripts/prolog.js
vendored
@ -1,5 +1,6 @@
|
||||
(function() {
|
||||
var createHandle, handle, _i, _len, _ref;
|
||||
|
||||
if (window.JHW) {
|
||||
window.console = {
|
||||
log: function(data) {
|
||||
@ -40,9 +41,7 @@
|
||||
e = e || window.event;
|
||||
JHW.hasError();
|
||||
JHW.stdout.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.');
|
||||
if (e) {
|
||||
e.returnValue = 'string';
|
||||
}
|
||||
if (e) e.returnValue = 'string';
|
||||
return 'string';
|
||||
};
|
||||
window.confirm = function(message) {
|
||||
@ -84,6 +83,9 @@
|
||||
return JHW.stdout.puts(msg);
|
||||
};
|
||||
}
|
||||
|
||||
window.CoffeeScriptToFilename = {};
|
||||
|
||||
window.CSTF = window.CoffeeScriptToFilename;
|
||||
|
||||
}).call(this);
|
||||
|
Loading…
Reference in New Issue
Block a user