describe("markups", function(){ var compile, element, scope; beforeEach(function() { scope = null; element = null; var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget); compile = function(html) { element = jqLite(html); scope = compiler.compile(element)(element); scope.$init(); }; }); afterEach(function(){ if (element) { element.remove(); } expect(_(jqCache).size()).toEqual(0); }); it('should translate {{}} in text', function(){ compile('
hello {{name}}!
'); expect(element.html()).toEqual('hello !'); scope.$set('name', 'Misko'); scope.$eval(); expect(element.html()).toEqual('hello Misko!'); }); it('should translate {{}} in terminal nodes', function(){ compile(''); expect(element.html()).toEqual(''); scope.$set('name', 'Misko'); scope.$eval(); expect(element.html()).toEqual(''); }); it('should translate {{}} in attributes', function(){ compile(''); expect(element.attr('src')).toEqual(); expect(element.attr('ng-bind-attr')).toEqual('{"src":"http://server/{{path}}.png"}'); scope.$set('path', 'a/b'); scope.$eval(); expect(element.attr('src')).toEqual("http://server/a/b.png"); }); it('should populate value attribute on OPTION', function(){ compile(''); expect(element.html()).toEqual(''); }); });