From be33f1e6d40d4dacde6d3c3c007d870816de2380 Mon Sep 17 00:00:00 2001 From: pivotal Date: Mon, 1 Dec 2008 17:57:21 -0800 Subject: [PATCH] dwf/rva: started suite testing. --- jasmine.iws | 43 ++++++++++++++++++++++++++++++++++++------- lib/jasmine.js | 16 +++++++++++++++- test/bootstrap.js | 34 ++++++++++++++++++++++++---------- 3 files changed, 75 insertions(+), 18 deletions(-) diff --git a/jasmine.iws b/jasmine.iws index dc331df..192ffe4 100644 --- a/jasmine.iws +++ b/jasmine.iws @@ -89,10 +89,10 @@ - + - + @@ -107,10 +107,10 @@ - + - + @@ -224,6 +224,28 @@ - + - + - + + + + + + + + diff --git a/lib/jasmine.js b/lib/jasmine.js index 5da421b..1f43b3f 100755 --- a/lib/jasmine.js +++ b/lib/jasmine.js @@ -123,17 +123,31 @@ var it = function (description) { } that.resetTimeout(); - return that; } that.runs = addToQueue; that.then = addToQueue; + currentSuite.tests.push(that); + + return that; } +var currentSuite; + +var describe = function (description, tests) { + var that = { + description: description, + tests: [] + } + currentSuite = that; + tests(); + return that; +} + /* * Jasmine constructor */ diff --git a/test/bootstrap.js b/test/bootstrap.js index 7ea28f2..6a6be7e 100755 --- a/test/bootstrap.js +++ b/test/bootstrap.js @@ -282,23 +282,37 @@ var waitForDone = function(spec, mockSuite) { }, 150); } +var testSuites = function () { + + // suite has a description + var suite = describe('one suite description', function() {}); + reporter.test((suite.description == 'one suite description'), + 'Suite did not get a description'); + + // suite can have a test + suite = describe('one suite description', function () { + it('should be a test'); + }); + + reporter.test((suite.tests[0].queue.length === 1), + 'Suite did not get a test pushed'); +} + + var runTests = function () { $('spinner').show(); - testMatchersComparisons(); - testMatchersReporting(); - testSpecs(); - testAsyncSpecs(); - testAsyncSpecsWithMockSuite(); +// testMatchersComparisons(); + // testMatchersReporting(); + // testSpecs(); + // testAsyncSpecs(); + // testAsyncSpecsWithMockSuite(); + testSuites(); setTimeout(function() { $('spinner').hide(); reporter.summary(); - }, 10000); + }, 100); } - //it('should be an async test') { - // run(function() {setup}).and.wait(2000).then.expects_that(true).should_equal(true).and.expects_that - //} -