diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/CompilerSpec.js | 20 | ||||
| -rw-r--r-- | test/jqLiteSpec.js | 31 |
2 files changed, 31 insertions, 20 deletions
diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index 498ee060..291a5011 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -166,24 +166,4 @@ describe('compiler', function(){ scope = compile('A---B---C===D'); expect(sortedHtml(scope.$element)).toEqual('<div>A<hr></hr>B<hr></hr>C<p></p>D</div>'); }); - - - describe('retrieveScope', function() { - it('should retrieve scope attached to the current element', function() { - scope = compile('<i>foo</i>'); - expect(retrieveScope(scope.$element)).toBe(scope); - }); - - it('should walk up the dom to find scope', function() { - scope = compile('<ul><li><p><b>deep deep</b><p></li></ul>'); - var deepChild = scope.$element[0].getElementsByTagName('b')[0]; - expect(retrieveScope(deepChild)).toBe(scope); - }); - - it('should return undefined when no scope was found', function() { - var html = jqLite('<ul><li><p><b>deep deep</b><p></li></ul>'), - deepChild = html[0].getElementsByTagName('b')[0]; - expect(retrieveScope(deepChild)).toBeNull(); - }); - }); }); diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js new file mode 100644 index 00000000..da8ab206 --- /dev/null +++ b/test/jqLiteSpec.js @@ -0,0 +1,31 @@ +describe('jqLite', function(){ + var scope; + + beforeEach(function(){ + scope = angular.scope(); + }); + + describe('scope', function() { + it('should retrieve scope attached to the current element', function() { + var element = jqLite('<i>foo</i>'); + element.data('$scope', scope); + expect(element.scope()).toBe(scope); + dealoc(element); + }); + + it('should 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('$scope', scope); + expect(deepChild.scope()).toBe(scope); + dealoc(element); + }); + + it('should return undefined when no scope was found', function() { + var element = jqLite('<ul><li><p><b>deep deep</b><p></li></ul>'); + var deepChild = jqLite(element[0].getElementsByTagName('b')[0]); + expect(deepChild.scope()).toBeNull(); + dealoc(element); + }); + }); +}); |
