dwf: monster file re-org. RED BUILD

This commit is contained in:
Davis W. Frank 2009-06-14 23:34:29 -07:00
parent e48c22ffbd
commit b2cbff3bb6
17 changed files with 107 additions and 4399 deletions

View File

@ -3,9 +3,10 @@
<html> <html>
<head> <head>
<title>Jasmine Tests</title> <title>Jasmine Tests</title>
<!--<script type="text/javascript" src="prototype-1.6.0.3.js"></script>-->
<script type="text/javascript" src="json2.js"></script> <script type="text/javascript" src="lib/json2.js"></script>
<script type="text/javascript" src="jsUnitMockTimeout.js"></script> <script type="text/javascript" src="lib/mock-timeout.js"></script>
<script type="text/javascript" src="../lib/jsUnitMockTimeout.js"></script>
<script type="text/javascript" src="../src/base.js"></script> <script type="text/javascript" src="../src/base.js"></script>
<script type="text/javascript" src="../src/util.js"></script> <script type="text/javascript" src="../src/util.js"></script>
<script type="text/javascript" src="../src/Env.js"></script> <script type="text/javascript" src="../src/Env.js"></script>
@ -19,9 +20,10 @@
<script type="text/javascript" src="../src/Spec.js"></script> <script type="text/javascript" src="../src/Spec.js"></script>
<script type="text/javascript" src="../src/Suite.js"></script> <script type="text/javascript" src="../src/Suite.js"></script>
<script type="text/javascript" src="../lib/json_reporter.js"></script> <script type="text/javascript" src="../lib/json_reporter.js"></script>
<script type="text/javascript" src="mock-timeout.js"></script>
<link type="text/css" rel="stylesheet" href="../lib/jasmine.css"/>
<script type="text/javascript" src="bootstrap.js"></script> <script type="text/javascript" src="bootstrap.js"></script>
<link type="text/css" rel="stylesheet" href="../lib/jasmine.css"/>
</head> </head>
<body onLoad="runTests();"> <body onLoad="runTests();">
<h1> <h1>

View File

@ -278,24 +278,20 @@ var runTests = function () {
runSuite('PrettyPrintTest.js'); runSuite('PrettyPrintTest.js');
runSuite('MatchersTest.js'); runSuite('MatchersTest.js');
runSuite('SpecRunningTest.js'); runSuite('SpecRunningTest.js');
testRunnerFinishCallback();
runSuite('NestedResultsTest.js'); runSuite('NestedResultsTest.js');
testFormatsExceptionMessages();
testHandlesExceptions();
testResultsAliasing();
runSuite('ReporterTest.js'); runSuite('ReporterTest.js');
runSuite('RunnerTest.js'); runSuite('RunnerTest.js');
runSuite('JsonReporterTest.js'); runSuite('JsonReporterTest.js');
runSuite('SpyTest.js'); runSuite('SpyTest.js');
testExplodes();
testRunnerFinishCallback();
testFormatsExceptionMessages();
testHandlesExceptions();
testResultsAliasing();
// handle blank specs will work later. // handle blank specs will work later.
// testHandlesBlankSpecs(); // testHandlesBlankSpecs();
reporter.summary(); reporter.summary();
document.getElementById('spinner').style.display = "none"; document.getElementById('spinner').style.display = "none";
}; };

74
spec/runner.html Normal file
View File

@ -0,0 +1,74 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Test Runner</title>
</head>
<script type="text/javascript" src="lib/json2.js"></script>
<script type="text/javascript" src="../src/base.js"></script>
<script type="text/javascript" src="../src/util.js"></script>
<script type="text/javascript" src="../src/Env.js"></script>
<script type="text/javascript" src="../src/ActionCollection.js"></script>
<script type="text/javascript" src="../src/Matchers.js"></script>
<script type="text/javascript" src="../src/NestedResults.js"></script>
<script type="text/javascript" src="../src/PrettyPrinter.js"></script>
<script type="text/javascript" src="../src/QueuedFunction.js"></script>
<script type="text/javascript" src="../src/Reporters.js"></script>
<script type="text/javascript" src="../src/Runner.js"></script>
<script type="text/javascript" src="../src/Spec.js"></script>
<script type="text/javascript" src="../src/Suite.js"></script>
<script type="text/javascript" src="../lib/TrivialReporter.js"></script>
<script type="text/javascript" src="../lib/json_reporter.js"></script>
<script type="text/javascript" src="lib/mock-timeout.js"></script>
<script type="text/javascript">
jasmine.include('suites/JsonReporterTest.js', true);
jasmine.include('suites/MatchersTest.js', true);
jasmine.include('suites/NestedResultsTest.js', true);
jasmine.include('suites/PrettyPrintTest.js', true);
jasmine.include('suites/ReporterTest.js', true);
jasmine.include('suites/RunnerTest.js', true);
jasmine.include('suites/SpecRunningTest.js', true);
jasmine.include('suites/SpyTest.js', true);
</script>
<style type="text/css">
.spec {
margin: 5px;
}
.passed {
background-color: lightgreen;
}
.failed {
background-color: pink;
}
.resultMessage {
white-space: pre;
}
.stackTrace {
white-space: pre;
font-size: .8em;
margin-left: 10px;
}
</style>
<body>
<script type="text/javascript">
var jasmineEnv = jasmine.getEnv();
jasmineEnv.reporter = new jasmine.TrivialReporter();
jasmineEnv.execute();
console.log('env', jasmineEnv);
</script>
</body>
</html>

View File

@ -672,6 +672,7 @@ describe("jasmine spec running", function () {
suite.execute(); suite.execute();
fakeTimer.tick(600); fakeTimer.tick(600);
expect(suite.specs[0].foo).toEqual(2); // "Spec does not maintain scope in between functions"); expect(suite.specs[0].foo).toEqual(2); // "Spec does not maintain scope in between functions");
expect(suite.specs[0].results.getItems().length).toEqual(2); // "Spec did not get results for all expectations"); expect(suite.specs[0].results.getItems().length).toEqual(2); // "Spec did not get results for all expectations");
expect(suite.specs[0].results.getItems()[0].passed).toEqual(false); // "Spec did not return false for a failed expectation"); expect(suite.specs[0].results.getItems()[0].passed).toEqual(false); // "Spec did not return false for a failed expectation");
@ -698,7 +699,7 @@ describe("jasmine spec running", function () {
it('shouldn\'t execute specs in disabled suites', function() { it('shouldn\'t execute specs in disabled suites', function() {
var spy = jasmine.createSpy(); var spy = jasmine.createSpy();
var disabledSuite = xdescribe('a disabled suite', function() { var disabledSuite = env.xdescribe('a disabled suite', function() {
it('enabled spec, but should not be run', function() { it('enabled spec, but should not be run', function() {
spy(); spy();
}); });
@ -709,4 +710,21 @@ describe("jasmine spec running", function () {
expect(spy).wasNotCalled(); expect(spy).wasNotCalled();
}); });
it('#explodes should throw an exception when it is called inside a spec', function() {
var exceptionMessage = false;
var suite = env.describe('Spec', function () {
it('plodes', function() {
try {
jasmine.explodes();
}
catch (e) {
exceptionMessage = e;
}
expect(exceptionMessage).toNotEqual(false);
});
});
suite.execute();
expect(exceptionMessage).toEqual('explodes function should not have been called');
});
}); });

View File

@ -5,9 +5,6 @@
/** @namespace */ /** @namespace */
var jasmine = {}; var jasmine = {};
/** @deprecated use jasmine (lowercase because it's a package name) instead */
var Jasmine = jasmine;
jasmine.unimplementedMethod_ = function() { jasmine.unimplementedMethod_ = function() {
throw new Error("unimplemented method"); throw new Error("unimplemented method");
}; };
@ -64,7 +61,6 @@ jasmine.any = function(clazz) {
return new jasmine.Matchers.Any(clazz); return new jasmine.Matchers.Any(clazz);
}; };
jasmine.createSpy = function(name) { jasmine.createSpy = function(name) {
var spyObj = function() { var spyObj = function() {
spyObj.wasCalled = true; spyObj.wasCalled = true;
@ -135,7 +131,6 @@ var it = function(desc, func) {
return jasmine.getEnv().it(desc, func); return jasmine.getEnv().it(desc, func);
}; };
//this mirrors the spec syntax so you can define a spec description that will not run.
var xit = function(desc, func) { var xit = function(desc, func) {
return jasmine.getEnv().xit(desc, func); return jasmine.getEnv().xit(desc, func);
}; };

View File

@ -1,57 +0,0 @@
jasmine.AjaxRequests = {
requests: $A(),
activeRequest: function() {
return this.requests.last();
},
add: function(request) {
this.requests.push(request);
var spec = jasmine.getEnv().currentSpec;
spec.after(function() { jasmine.AjaxRequests.clear(); });
},
remove: function(request) {
this.requests = this.requests.without(request);
},
clear: function() {
this.requests.clear();
}
};
jasmine.AjaxRequest = Class.create(Ajax.Request, {
request: function(url) {
this.url = url;
this.method = this.options.method;
var params = Object.clone(this.options.parameters);
if (!['get', 'post'].include(this.method)) {
// simulate other verbs over post
params['_method'] = this.method;
this.method = 'post';
}
this.parameters = params;
if (params = Object.toQueryString(params)) {
// when GET, append parameters to URL
if (this.method == 'get')
this.url += (this.url.include('?') ? '&' : '?') + params;
else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
params += '&_=';
}
jasmine.AjaxRequests.add(this);
},
response: function(response) {
if (!response.status || response.status == 200 || response.status == "200") {
if (this.options.onSuccess) {this.options.onSuccess(response);}
} else {
if (this.options.onFailure) {this.options.onFailure(response);}
}
if (this.options.onComplete) {this.options.onComplete(response);}
jasmine.AjaxRequests.remove(this);
}
});

File diff suppressed because it is too large Load Diff