diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/jqLiteSpec.js | 25 | 
1 files changed, 23 insertions, 2 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 5b2e35b0..5cad8c24 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -140,8 +140,8 @@ describe('jqLite', function() {    describe('injector', function() {      it('should retrieve injector attached to the current element or its parent', function() {        var template = jqLite('<div><span></span></div>'), -          span = template.children().eq(0), -          injector = angular.bootstrap(template); +        span = template.children().eq(0), +        injector = angular.bootstrap(template);        expect(span.injector()).toBe(injector); @@ -150,6 +150,27 @@ describe('jqLite', function() {    }); +  describe('controller', function() { +    it('should retrieve controller attached to the current element or its parent', function() { +      var div = jqLite('<div><span></span></div>'), +          span = div.find('span'); + +      div.data('$ngControllerController', 'ngController'); +      span.data('$otherController', 'other'); + +      expect(span.controller()).toBe('ngController'); +      expect(span.controller('ngController')).toBe('ngController'); +      expect(span.controller('other')).toBe('other'); + +      expect(div.controller()).toBe('ngController'); +      expect(div.controller('ngController')).toBe('ngController'); +      expect(div.controller('other')).toBe(undefined); + +      dealoc(div); +    }); +  }); + +    describe('data', function() {      it('should set and get and remove data', function() {        var selected = jqLite([a, b, c]);  | 
