dwf/rva: async working with .waits() syntax; simple case

This commit is contained in:
pivotal
2008-12-01 14:24:13 -08:00
parent a4979fe851
commit 3e02023d9f
5 changed files with 89 additions and 53 deletions

View File

@@ -12,7 +12,8 @@
<h1>
Running all Jasmine Test Suites
</h1>
<div id="icons">
<div id="icon_wrapper">
<span id="icons"></span>
<img id="spinner" src="spinner.gif" alt="" />
</div>
<div id="report">

58
test/bootstrap.js vendored
View File

@@ -151,46 +151,50 @@ var testAsyncSpecs = function () {
runs(function () {
foo++;
}).then(function() {
expects_that(foo).should_equal(1)
});
a_spec.execute();
reporter.test((Jasmine.results.length === 1),
'Spec queue did not run all functions');
reporter.test((Jasmine.results[0].passed === true),
'Queued expectation failed');
Jasmine = jasmine_init();
foo = 0;
a_spec = it_async('spec w/ queued statments').
runs(function () {
setTimeout(function() {
foo++
}, 500);
}).waits(1000).then(function() {
expects_that(foo).should_equal(1);
});
a_spec.execute();
reporter.test((Jasmine.results.length === 1),
'Spec queue did not run all functions');
'No call to waits(): Spec queue did not run all functions');
reporter.test((Jasmine.results[0].passed === true),
'Queued expectation failed');
'No call to waits(): Queued expectation failed');
Jasmine = jasmine_init();
foo = 0;
a_spec = it_async('spec w/ queued statments').
runs(function () {
setTimeout(function() {
foo++
}, 500);
}).waits(1000).
then(function() {
expects_that(foo).should_equal(1);
});
a_spec.execute();
setTimeout(function(){
reporter.test((Jasmine.results.length === 1),
'Calling waits(): Spec queue did not run all functions');
reporter.test((Jasmine.results[0].passed === true),
'Calling waits(): Queued expectation failed');
}, 1250);
}
var runTests = function () {
$('spinner').show();
// testMatchersComparisons();
// testMatchersReporting();
// testSpecs();
testMatchersComparisons();
testMatchersReporting();
testSpecs();
testAsyncSpecs();
$('spinner').hide();
reporter.summary();
setTimeout(function() {
$('spinner').hide();
reporter.summary();
}, 1500);
}
//it('should be an async test') {

View File

@@ -3,10 +3,6 @@ body {
padding-left: 40px;
}
img#spinner {
display: block;
}
h1 {
padding-top: 20px;
font-weight: bold;