diff options
| author | Igor Minar | 2011-03-06 23:42:25 -0800 | 
|---|---|---|
| committer | Igor Minar | 2011-03-11 08:45:16 -0800 | 
| commit | 7414e7b53302863911c734c8586b76767d2ded6b (patch) | |
| tree | 1ab801858bb019f8bf05a1a5f23753e3f7eaf01c /test/AngularSpec.js | |
| parent | 5432dd289a38a43fc5db35a30b68c2a5b0dd169e (diff) | |
| download | angular.js-7414e7b53302863911c734c8586b76767d2ded6b.tar.bz2 | |
angularJsConfig now allows ng:autobind and #autobind value to be passed in
Diffstat (limited to 'test/AngularSpec.js')
| -rw-r--r-- | test/AngularSpec.js | 36 | 
1 files changed, 33 insertions, 3 deletions
| diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 2352cdf8..e9215bee 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -266,25 +266,41 @@ describe('angular', function(){      }); -    it('should extract angular config from the ng: attributes', function() { +    it('should extract angular config from the ng: attributes', +        function() {        var doc = { getElementsByTagName: function(tagName) {          expect(lowercase(tagName)).toEqual('script');          return [{nodeName: 'SCRIPT',            src: 'angularjs/angular.js', -          attributes: [{name: 'ng:autobind', value:undefined}, +          attributes: [{name: 'ng:autobind', value:'elementIdToCompile'},                         {name: 'ng:css', value: 'css/my_custom_angular.css'},                         {name: 'ng:ie-compat', value: 'myjs/angular-ie-compat.js'},                         {name: 'ng:ie-compat-id', value: 'ngcompat'}] }];        }};        expect(angularJsConfig(doc)).toEqual({base_url: 'angularjs/', -        autobind: true, +        autobind: 'elementIdToCompile',          css: 'css/my_custom_angular.css',          ie_compat: 'myjs/angular-ie-compat.js',          ie_compat_id: 'ngcompat'});      }); +    it('should extract angular config and default autobind value to true if present', function() { +      var doc = { getElementsByTagName: function(tagName) { +        expect(lowercase(tagName)).toEqual('script'); +        return [{nodeName: 'SCRIPT', +          src: 'angularjs/angular.js', +          attributes: [{name: 'ng:autobind', value:undefined}]}]; +      }}; + +      expect(angularJsConfig(doc)).toEqual({autobind: true, +                                            base_url: 'angularjs/', +                                            ie_compat_id: 'ng-ie-compat', +                                            ie_compat: 'angularjs/angular-ie-compat.js'}); +    }); + +      it('should extract angular autobind config from the script hashpath attributes', function() {        var doc = { getElementsByTagName: function(tagName) {          expect(lowercase(tagName)).toEqual('script'); @@ -299,6 +315,20 @@ describe('angular', function(){      }); +    it('should extract autobind config with element id from the script hashpath', function() { +      var doc = { getElementsByTagName: function(tagName) { +        expect(lowercase(tagName)).toEqual('script'); +        return [{nodeName: 'SCRIPT', +          src: 'angularjs/angular.js#autobind=foo'}]; +      }}; + +      expect(angularJsConfig(doc)).toEqual({base_url: 'angularjs/', +        autobind: 'foo', +        ie_compat: 'angularjs/angular-ie-compat.js', +        ie_compat_id: 'ng-ie-compat'}); +    }); + +      it("should default to versioned ie-compat file if angular file is versioned", function() {        var doc = { getElementsByTagName: function(tagName) {          expect(lowercase(tagName)).toEqual('script'); | 
