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