describe("directive", function(){ var compile, model, element; beforeEach(function() { compile = function(html) { element = jqLite(html); return model = angular.compile(element)().scope; }; }); afterEach(function() { dealoc(model); }); it("should ng:init", function() { var scope = compile('
'); expect(scope.a).toEqual(123); }); it("should ng:eval", function() { var scope = compile(''); expect(scope.a).toEqual(1); scope.$eval(); expect(scope.a).toEqual(2); }); describe('ng:bind', function(){ it('should set text', function() { var scope = compile(''); expect(element.text()).toEqual(''); scope.a = 'misko'; scope.$eval(); expect(element.hasClass('ng-binding')).toEqual(true); expect(element.text()).toEqual('misko'); }); it('should set text to blank if undefined', function() { var scope = compile(''); scope.a = 'misko'; scope.$eval(); expect(element.text()).toEqual('misko'); scope.a = undefined; scope.$eval(); expect(element.text()).toEqual(''); }); it('should set html', function() { var scope = compile(''); scope.html = '