diff options
Diffstat (limited to 'test/jqLiteSpec.js')
| -rw-r--r-- | test/jqLiteSpec.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 24920273..02a17df8 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -151,6 +151,13 @@ describe('jqLite', function() { dealoc(element); }); + it('should retrieve isolate scope attached to the current element', function() { + var element = jqLite('<i>foo</i>'); + element.data('$isolateScope', scope); + expect(element.isolateScope()).toBe(scope); + dealoc(element); + }); + it('should retrieve scope attached to the html element if its requested on the document', function() { var doc = jqLite(document), @@ -182,6 +189,33 @@ describe('jqLite', function() { }); + describe('isolateScope', function() { + + it('should retrieve isolate scope attached to the current element', function() { + var element = jqLite('<i>foo</i>'); + element.data('$isolateScope', scope); + expect(element.isolateScope()).toBe(scope); + dealoc(element); + }); + + + it('should not walk up the dom to find scope', function() { + var element = jqLite('<ul><li><p><b>deep deep</b><p></li></ul>'); + var deepChild = jqLite(element[0].getElementsByTagName('b')[0]); + element.data('$isolateScope', scope); + expect(deepChild.isolateScope()).toBeUndefined(); + dealoc(element); + }); + + + it('should return undefined when no scope was found', function() { + var element = jqLite('<div></div>'); + expect(element.isolateScope()).toBeFalsy(); + dealoc(element); + }); + }); + + describe('injector', function() { it('should retrieve injector attached to the current element or its parent', function() { var template = jqLite('<div><span></span></div>'), |
