diff options
| author | Shyam Seshadri | 2010-08-10 10:48:31 -0700 |
|---|---|---|
| committer | Shyam Seshadri | 2010-08-10 10:48:31 -0700 |
| commit | 86c2ef87d5069f0836079e171c0f33efcf2b5d24 (patch) | |
| tree | cc99bb5bfcc1d0ff5a0ac8382c9ffe2352d167bf /test/scenario | |
| parent | 21d2b43e6c81b7b6b55599f0274495d25411b4f0 (diff) | |
| download | angular.js-86c2ef87d5069f0836079e171c0f33efcf2b5d24.tar.bz2 | |
Inject jquery into future scope, and rename outer scenario to _window, which is what it is
Diffstat (limited to 'test/scenario')
| -rw-r--r-- | test/scenario/DSLSpec.js | 7 | ||||
| -rw-r--r-- | test/scenario/RunnerSpec.js | 24 | ||||
| -rw-r--r-- | test/scenario/TestContext.js | 8 |
3 files changed, 20 insertions, 19 deletions
diff --git a/test/scenario/DSLSpec.js b/test/scenario/DSLSpec.js index a6a291f8..374f49c8 100644 --- a/test/scenario/DSLSpec.js +++ b/test/scenario/DSLSpec.js @@ -5,15 +5,16 @@ describe("DSL", function() { beforeEach(function() { setUpContext(); executeFuture = function(future, html, callback) { - lastDocument =_jQuery('<div>' + html + '</div>'); + lastDocument = _jQuery('<div>' + html + '</div>'); _jQuery(document.body).append(lastDocument); var specThis = { testWindow: window, - testDocument: lastDocument + testDocument: lastDocument, + jQuery: _jQuery }; future.behavior.call(specThis, callback || noop); }; - Expect = scenario.expect; + Expect = _window.expect; }); describe("input", function() { diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js index 2eb13f7f..b12c43c6 100644 --- a/test/scenario/RunnerSpec.js +++ b/test/scenario/RunnerSpec.js @@ -4,10 +4,10 @@ describe('Runner', function() { beforeEach(function() { setUpContext(); - Describe = scenario.describe; - It = scenario.it; - BeforeEach = scenario.beforeEach; - AfterEach = scenario.afterEach; + Describe = _window.describe; + It = _window.it; + BeforeEach = _window.beforeEach; + AfterEach = _window.afterEach; body = _jQuery('<div></div>'); }); @@ -101,7 +101,7 @@ describe('Runner', function() { }); $scenario.run(body); expect(log).toEqual('future1;after;future2;after;'); - expect(scenario.$testrun.results).toEqual([ + expect(_window.$testrun.results).toEqual([ { name : 'describe name: it should text1', passed : false, error : 'AfterError', @@ -186,7 +186,7 @@ describe('Runner', function() { expect(spec.result.failed).toEqual(true); expect(spec.result.finished).toEqual(true); expect(spec.result.error).toEqual("MyError"); - expect(scenario.$testrun.results).toEqual([{ + expect(_window.$testrun.results).toEqual([{ name: 'spec', passed: false, error: 'MyError', @@ -217,16 +217,16 @@ describe('Runner', function() { expect(log).toEqual('s1,s2,s3,s4,'); }); it('should publish done state and results as tests are run', function() { - expect(scenario.$testrun.done).toBeFalsy(); - expect(scenario.$testrun.results).toEqual([]); + expect(_window.$testrun.done).toBeFalsy(); + expect(_window.$testrun.results).toEqual([]); $scenario.run(body); - expect(scenario.$testrun.done).toBeFalsy(); - expect(scenario.$testrun.results).toEqual([ + expect(_window.$testrun.done).toBeFalsy(); + expect(_window.$testrun.results).toEqual([ {name: 'd1: it it1', passed: true, error: undefined, steps: ['s1']} ]); next(); - expect(scenario.$testrun.done).toBeTruthy(); - expect(scenario.$testrun.results).toEqual([ + expect(_window.$testrun.done).toBeTruthy(); + expect(_window.$testrun.results).toEqual([ {name: 'd1: it it1', passed: true, error: undefined, steps: ['s1']}, {name: 'd1: it it2', passed: true, error: undefined, steps: ['s2', 's2.2']}, {name: 'd2: it it3', passed: true, error: undefined, steps: ['s3']}, diff --git a/test/scenario/TestContext.js b/test/scenario/TestContext.js index ebb40b95..0c8e6143 100644 --- a/test/scenario/TestContext.js +++ b/test/scenario/TestContext.js @@ -1,4 +1,4 @@ -var scenario, runner, log, $scenario; +var _window, runner, log, $scenario; function logger(text) { return function(done){ @@ -8,8 +8,8 @@ function logger(text) { } function setUpContext() { - scenario = {}; - runner = new angular.scenario.Runner(scenario, _jQuery); - $scenario = scenario.$scenario; + _window = {}; + runner = new angular.scenario.Runner(_window, _jQuery); + $scenario = _window.$scenario; log = ''; } |
