diff options
| author | Misko Hevery | 2010-10-23 13:10:42 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-10-23 13:12:45 -0700 | 
| commit | 6ddcf918610c1dd094a964fc03e129a67f17dfaa (patch) | |
| tree | ba690c591b40c97f86d0aef9a2a160e46356a7f0 | |
| parent | 8a867cee229b78f5bfde6a05fdbe0d7d3d608e11 (diff) | |
| download | angular.js-6ddcf918610c1dd094a964fc03e129a67f17dfaa.tar.bz2 | |
Fix test which was causing the Chrome runner to fail. Upgraded JSTD to latest. Cleanup whitespace.
| -rw-r--r-- | lib/jstestdriver/JsTestDriver.jar | bin | 3168906 -> 3698736 bytes | |||
| -rw-r--r-- | test/scenario/ApplicationSpec.js | 24 | ||||
| -rw-r--r-- | test/scenario/DescribeSpec.js | 22 | ||||
| -rw-r--r-- | test/scenario/FutureSpec.js | 18 | ||||
| -rw-r--r-- | test/scenario/HtmlUISpec.js | 4 | ||||
| -rw-r--r-- | test/scenario/RunnerSpec.js | 12 | ||||
| -rw-r--r-- | test/scenario/SpecRunnerSpec.js | 10 | ||||
| -rw-r--r-- | test/scenario/dslSpec.js | 4 | ||||
| -rw-r--r-- | test/scenario/matchersSpec.js | 8 | 
9 files changed, 52 insertions, 50 deletions
| diff --git a/lib/jstestdriver/JsTestDriver.jar b/lib/jstestdriver/JsTestDriver.jarBinary files differ index cb30a6dc..c32dae01 100644 --- a/lib/jstestdriver/JsTestDriver.jar +++ b/lib/jstestdriver/JsTestDriver.jar diff --git a/test/scenario/ApplicationSpec.js b/test/scenario/ApplicationSpec.js index 2fb9881f..883701ba 100644 --- a/test/scenario/ApplicationSpec.js +++ b/test/scenario/ApplicationSpec.js @@ -9,8 +9,8 @@ describe('angular.scenario.Application', function() {    it('should return new $window and $document after navigate', function() {      var testWindow, testDocument, counter = 0;      app.navigateTo = noop; -    app.getWindow = function() {  -      return {x:counter++, document:{x:counter++}};  +    app.getWindow = function() { +      return {x:counter++, document:{x:counter++}};      };      app.navigateTo('http://www.google.com/');      app.executeAction(function($document, $window) { @@ -26,8 +26,8 @@ describe('angular.scenario.Application', function() {    it('should execute callback with correct arguments', function() {      var testWindow = {document: {}}; -    app.getWindow = function() {  -      return testWindow;  +    app.getWindow = function() { +      return testWindow;      };      app.executeAction(function($window, $document) {        expect(this).toEqual(app); @@ -35,7 +35,7 @@ describe('angular.scenario.Application', function() {        expect($window).toEqual(testWindow);      });    }); -   +    it('should create a new iframe each time', function() {      app.navigateTo('about:blank');      var frame = app.getFrame(); @@ -43,27 +43,27 @@ describe('angular.scenario.Application', function() {      app.navigateTo('about:blank');      expect(app.getFrame().attr('test')).toBeFalsy();    }); -   +    it('should URL description bar', function() {      app.navigateTo('about:blank');      var anchor = frames.find('> h2 a');      expect(anchor.attr('href')).toEqual('about:blank');      expect(anchor.text()).toEqual('about:blank');    }); -   +    it('should call onload handler when frame loads', function() {      var called;      app.getFrame = function() {        // Mock a little jQuery        var result = { -        remove: function() {  -          return result;  +        remove: function() { +          return result;          }, -        attr: function(key, value) {  +        attr: function(key, value) {            return (!value) ? 'attribute value' : result;          }, -        load: function() {  -          called = true;  +        load: function() { +          called = true;          }        };        return result; diff --git a/test/scenario/DescribeSpec.js b/test/scenario/DescribeSpec.js index 417a0d2e..c2e7310e 100644 --- a/test/scenario/DescribeSpec.js +++ b/test/scenario/DescribeSpec.js @@ -4,21 +4,21 @@ describe('angular.scenario.Describe', function() {    beforeEach(function() {      root = new angular.scenario.Describe(); -     +      /**       * Simple callback logging system. Use to assert proper order of calls.       */ -    log = function(text) {  -      log.text = log.text + text;  +    log = function(text) { +      log.text = log.text + text;      };      log.fn = function(text) { -      return function(done){  -        log(text);  -        (done || angular.noop)();  +      return function(done){ +        log(text); +        (done || angular.noop)();        };      }; -    log.reset = function() {  -      log.text = '';  +    log.reset = function() { +      log.text = '';      };      log.reset();    }); @@ -50,7 +50,7 @@ describe('angular.scenario.Describe', function() {      specs[1].after();      expect(log.text).toEqual('{1}');    }); -     +    it('should link nested describe blocks with parent and children', function() {      root.describe('A', function() {        this.it('1', angular.noop); @@ -65,7 +65,7 @@ describe('angular.scenario.Describe', function() {      expect(specs[2].definition.parent).toEqual(root);      expect(specs[0].definition.parent).toEqual(specs[2].definition.children[0]);    }); -   +    it('should not process xit and xdescribe', function() {      root.describe('A', function() {        this.xit('1', angular.noop); @@ -79,7 +79,7 @@ describe('angular.scenario.Describe', function() {      var specs = root.getSpecs();      expect(specs.length).toEqual(0);    }); -   +    it('should create uniqueIds in the tree', function() {      angular.scenario.Describe.id = 0;      var a = new angular.scenario.Describe(); diff --git a/test/scenario/FutureSpec.js b/test/scenario/FutureSpec.js index 52bd9c66..827c4b35 100644 --- a/test/scenario/FutureSpec.js +++ b/test/scenario/FutureSpec.js @@ -1,6 +1,6 @@  describe('angular.scenario.Future', function() {    var future; -   +    it('should set the sane defaults', function() {      var behavior = function() {};      var future = new angular.scenario.Future('test name', behavior, 'foo'); @@ -11,7 +11,7 @@ describe('angular.scenario.Future', function() {      expect(future.fulfilled).toBeFalsy();      expect(future.parser).toEqual(angular.identity);    }); -   +    it('should be fulfilled after execution and done callback', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(); @@ -19,7 +19,7 @@ describe('angular.scenario.Future', function() {      future.execute(angular.noop);      expect(future.fulfilled).toBeTruthy();    }); -   +    it('should take callback with (error, result) and forward', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(10, 20); @@ -29,7 +29,7 @@ describe('angular.scenario.Future', function() {        expect(result).toEqual(20);      });    }); -   +    it('should use error as value if provided', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(10, 20); @@ -37,7 +37,7 @@ describe('angular.scenario.Future', function() {      future.execute(angular.noop);      expect(future.value).toEqual(10);    }); -   +    it('should parse json with fromJson', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(null, "{test: 'foo'}"); @@ -45,7 +45,7 @@ describe('angular.scenario.Future', function() {      future.fromJson().execute(angular.noop);      expect(future.value).toEqual({test: 'foo'});    }); -   +    it('should convert to json with toJson', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(null, {test: 'foo'}); @@ -53,7 +53,7 @@ describe('angular.scenario.Future', function() {      future.toJson().execute(angular.noop);      expect(future.value).toEqual('{"test":"foo"}');    }); -   +    it('should convert with custom parser', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(null, 'foo'); @@ -63,7 +63,7 @@ describe('angular.scenario.Future', function() {      }).execute(angular.noop);      expect(future.value).toEqual('FOO');    }); -   +    it('should pass error if parser fails', function() {      var future = new angular.scenario.Future('test name', function(done) {        done(null, '{'); @@ -71,5 +71,5 @@ describe('angular.scenario.Future', function() {      future.fromJson().execute(function(error, result) {        expect(error).toBeDefined();      }); -  });   +  });  }); diff --git a/test/scenario/HtmlUISpec.js b/test/scenario/HtmlUISpec.js index 9357e00b..2c9ff080 100644 --- a/test/scenario/HtmlUISpec.js +++ b/test/scenario/HtmlUISpec.js @@ -2,7 +2,7 @@ describe('angular.scenario.HtmlUI', function() {    var ui;    var context;    var spec; -   +    function line() { return 'unknown:-1'; }    beforeEach(function() { @@ -85,7 +85,7 @@ describe('angular.scenario.HtmlUI', function() {          expect(timer.innerHTML).toMatch(/ms$/);      });    }); -   +    it('should include line if provided', function() {      specUI = ui.addSpec(spec);      specUI.addStep('some step', line).finish('error!'); diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js index d34a228c..1641a8f1 100644 --- a/test/scenario/RunnerSpec.js +++ b/test/scenario/RunnerSpec.js @@ -16,7 +16,7 @@ MockSpecRunner.prototype.addFuture = function(name, fn, line) {  describe('angular.scenario.Runner', function() {    var $window;    var runner; -   +    beforeEach(function() {      // Trick to get the scope out of a DSL statement      angular.scenario.dsl('dslAddFuture', function() { @@ -42,12 +42,12 @@ describe('angular.scenario.Runner', function() {      };      runner = new angular.scenario.Runner($window);    }); -   +    afterEach(function() {      delete angular.scenario.dsl.dslScope;      delete angular.scenario.dsl.dslChain;    }); -   +    it('should publish the functions in the public API', function() {      angular.foreach(runner.api, function(fn, name) {        var func; @@ -57,7 +57,7 @@ describe('angular.scenario.Runner', function() {        expect(angular.isFunction(func)).toBeTruthy();      });    }); -   +    it('should construct valid describe trees with public API', function() {      var before = [];      var after = []; @@ -85,7 +85,7 @@ describe('angular.scenario.Runner', function() {      expect(specs[2].definition.parent).toEqual(runner.rootDescribe);      expect(specs[0].definition.parent).toEqual(specs[2].definition.children[0]);    }); -   +    it('should publish the DSL statements to the $window', function() {      $window.describe('describe', function() {        $window.it('1', function() { @@ -94,7 +94,7 @@ describe('angular.scenario.Runner', function() {      });      runner.run(null/*ui*/, null/*application*/, MockSpecRunner, rethrow);    }); -   +    it('should create a new scope for each DSL chain', function() {      $window.describe('describe', function() {        $window.it('1', function() { diff --git a/test/scenario/SpecRunnerSpec.js b/test/scenario/SpecRunnerSpec.js index dd7a1b72..921d6853 100644 --- a/test/scenario/SpecRunnerSpec.js +++ b/test/scenario/SpecRunnerSpec.js @@ -49,7 +49,7 @@ ApplicationMock.prototype = {  describe('angular.scenario.SpecRunner', function() {    var $window;    var runner; -   +    function createSpec(name, body) {      return {        name: name, @@ -93,8 +93,8 @@ describe('angular.scenario.SpecRunner', function() {    it('should execute spec function and notify UI', function() {      var finished;      var ui = new UIMock(); -    var spec = createSpec('test spec', function() {  -      this.test = 'some value';  +    var spec = createSpec('test spec', function() { +      this.test = 'some value';      });      runner.addFuture('test future', function(done) {        done(); @@ -115,7 +115,7 @@ describe('angular.scenario.SpecRunner', function() {    it('should execute notify UI on spec setup error', function() {      var finished;      var ui = new UIMock(); -    var spec = createSpec('test spec', function() {  +    var spec = createSpec('test spec', function() {        throw 'message';      });      runner.run(ui, spec, function() { @@ -166,7 +166,7 @@ describe('angular.scenario.SpecRunner', function() {        'spec finish:'      ]);    }); -   +    it('should run after handlers even if error in body of spec', function() {      var finished, after;      var ui = new UIMock(); diff --git a/test/scenario/dslSpec.js b/test/scenario/dslSpec.js index e3e06b3e..b9d59fe4 100644 --- a/test/scenario/dslSpec.js +++ b/test/scenario/dslSpec.js @@ -190,7 +190,9 @@ describe("angular.scenario.dsl", function() {      describe('Element', function() {        it('should execute click', function() {          var clicked; -        doc.append('<a href=""></a>'); +        // Hash is important, otherwise we actually +        // go to a different page and break the runner +        doc.append('<a href="#"></a>');          doc.find('a').click(function() {            clicked = true;          }); diff --git a/test/scenario/matchersSpec.js b/test/scenario/matchersSpec.js index faabd1a2..16ba1ce6 100644 --- a/test/scenario/matchersSpec.js +++ b/test/scenario/matchersSpec.js @@ -1,6 +1,6 @@  describe('angular.scenario.matchers', function () {    var matchers; -   +    function expectMatcher(value, test) {      delete matchers.error;      delete matchers.future.value; @@ -10,9 +10,9 @@ describe('angular.scenario.matchers', function () {      test();      expect(matchers.error).toBeUndefined();    } -   +    beforeEach(function() { -    /**  +    /**       * Mock up the future system wrapped around matchers.       *       * @see Scenario.js#angular.scenario.matcher @@ -27,7 +27,7 @@ describe('angular.scenario.matchers', function () {      };      angular.extend(matchers, angular.scenario.matcher);    }); -   +    it('should handle basic matching', function() {      expectMatcher(10, function() { matchers.toEqual(10); });      expectMatcher('value', function() { matchers.toBeDefined(); }); | 
