From 6ff550cfa9524bbb124d10caf1fc13c911ab3b4b Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 22 Mar 2010 21:29:57 -0700 Subject: all angular.js directives now work --- test/CompilerSpec.js | 2 +- test/directivesSpec.js | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index 3ea2e473..57b597c4 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -40,7 +40,7 @@ describe('compiler', function(){ directives.directive = function(expression, element){ log += "found"; expect(expression).toEqual("expr"); - expect(element.element).toEqual(e); + expect(element[0]).toEqual(e); return function initFn() { log += ":init"; }; diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 7e0446ef..d125d326 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -6,7 +6,7 @@ describe("directives", function(){ var compiler = new Compiler(angularMarkup, angularDirective, angularWidget); compile = function(html) { element = jqLite(html); - var view = compiler.compile(element.element)(element.element); + var view = compiler.compile(element)(element); view.init(); return view.scope; }; @@ -108,4 +108,47 @@ describe("directives", function(){ element.click(); expect(scope.get('clicked')).toEqual(true); }); + + it('should ng-class', function(){ + var scope = compile('
'); + scope.updateView(); + expect(element.hasClass('existing')).toBeTruthy(); + expect(element.hasClass('A')).toBeTruthy(); + expect(element.hasClass('B')).toBeTruthy(); + }); + + it('should ng-class odd/even', function(){ + var scope = compile('