From 5a8ad8fe329fc09898ff43a060710265d38393be Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 1 Dec 2010 20:29:54 -0800 Subject: Closes #170. Corrected the behavior of select when options are ng:repeated - Delete $postEval method, as it was a hack --- test/CompilerSpec.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'test/CompilerSpec.js') diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index fa63ab77..d8c7c1b8 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -1,5 +1,5 @@ describe('compiler', function(){ - var compiler, markup, directives, widgets, compile, log; + var compiler, markup, directives, widgets, compile, log, scope; beforeEach(function(){ log = ""; @@ -32,6 +32,10 @@ describe('compiler', function(){ return scope; }; }); + + afterEach(function(){ + dealoc(scope); + }); it('should recognize a directive', function(){ var e = jqLite('
'); @@ -44,7 +48,8 @@ describe('compiler', function(){ }; }; var template = compiler.compile(e); - var init = template(e).$init; + scope = template(e); + var init = scope.$init; expect(log).toEqual("found"); init(); expect(e.hasClass('ng-directive')).toEqual(true); @@ -52,12 +57,12 @@ describe('compiler', function(){ }); it('should recurse to children', function(){ - var scope = compile('
'); + scope = compile('
'); expect(log).toEqual("hello misko"); }); it('should watch scope', function(){ - var scope = compile(''); + scope = compile(''); expect(log).toEqual(""); scope.$eval(); scope.$set('name', 'misko'); @@ -71,7 +76,7 @@ describe('compiler', function(){ it('should prevent descend', function(){ directives.stop = function(){ this.descend(false); }; - var scope = compile(''); + scope = compile(''); expect(log).toEqual("hello misko"); }); @@ -87,7 +92,7 @@ describe('compiler', function(){ }); }; }; - var scope = compile('beforexafter'); + scope = compile('beforexafter'); expect(sortedHtml(scope.$element)).toEqual('
before<#comment>xafter
'); scope.$eval(); expect(sortedHtml(scope.$element)).toEqual('
before<#comment>xxafter
'); @@ -103,7 +108,7 @@ describe('compiler', function(){ textNode[0].nodeValue = 'replaced'; } }); - var scope = compile('beforemiddleafter'); + scope = compile('beforemiddleafter'); expect(sortedHtml(scope.$element[0], true)).toEqual('
beforereplacedafter
'); expect(log).toEqual("hello middle"); }); @@ -116,7 +121,7 @@ describe('compiler', function(){ log += 'init'; }; }; - var scope = compile('push me'); + scope = compile('push me'); expect(lowercase(scope.$element[0].innerHTML)).toEqual('
button
'); expect(log).toEqual('init'); }); @@ -135,7 +140,7 @@ describe('compiler', function(){ if (text == '{{1+2}}') parent.text('3'); }); - var scope = compile('

ignore me

'); + scope = compile('

ignore me

'); expect(scope.$element.text()).toEqual('3'); }); @@ -158,7 +163,7 @@ describe('compiler', function(){ textNode.remove(); } }); - var scope = compile('A---B---C===D'); + scope = compile('A---B---C===D'); expect(sortedHtml(scope.$element)).toEqual('
A
B
C

D
'); }); -- cgit v1.2.3