From f6c67e28c94033edf6a16eb6508de54679cb49db Mon Sep 17 00:00:00 2001 From: Andres Ornelas Mesta Date: Mon, 24 May 2010 13:54:32 -0700 Subject: happy --- test/jquery_alias.js | 1 + test/jquery_remove.js | 1 + test/scenario/RunnerSpec.js | 34 +++++++++++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 test/jquery_alias.js create mode 100644 test/jquery_remove.js (limited to 'test') diff --git a/test/jquery_alias.js b/test/jquery_alias.js new file mode 100644 index 00000000..4b3fad00 --- /dev/null +++ b/test/jquery_alias.js @@ -0,0 +1 @@ +var _jQuery = jQuery; \ No newline at end of file diff --git a/test/jquery_remove.js b/test/jquery_remove.js new file mode 100644 index 00000000..5283c340 --- /dev/null +++ b/test/jquery_remove.js @@ -0,0 +1 @@ +var _jQuery = jQuery.noConflict(true); \ No newline at end of file diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js index 2883ab7c..702e1ab5 100644 --- a/test/scenario/RunnerSpec.js +++ b/test/scenario/RunnerSpec.js @@ -1,14 +1,18 @@ describe('Runner', function(){ - var scenario, runner, log, Describe, It, $scenario; + var scenario, runner, log, Describe, It, $scenario, body; function logger(text) { - return function(){log += text;}; + return function(done){ + log += text; + (done||noop)(); + }; } beforeEach(function(){ log = ''; scenario = {}; - runner = new angular.scenario.Runner(scenario); + body = _jQuery('
'); + runner = new angular.scenario.Runner(scenario, _jQuery); Describe = scenario.describe; It = scenario.it; $scenario = scenario.$scenario; @@ -105,4 +109,28 @@ describe('Runner', function(){ }); }); + describe('run', function(){ + var next; + it('should execute all specs', function(){ + Describe('d1', function(){ + It('it1', function(){ $scenario.addStep('s1', logger('s1,')); }); + It('it2', function(){ + $scenario.addStep('s2', logger('s2,')); + $scenario.addStep('s2.2', function(done){ next = done; }); + }); + }); + Describe('d2', function(){ + It('it3', function(){ $scenario.addStep('s3', logger('s3,')); }); + It('it4', function(){ $scenario.addStep('s4', logger('s4,')); }); + }); + + $scenario.run(body); + + expect(log).toEqual('s1,s2,'); + next(); + expect(log).toEqual('s1,s2,s3,s4,'); + + }); + }); + }); \ No newline at end of file -- cgit v1.2.3