angular.js/test/ScenarioSpec.js
Misko Hevery d12df0d360 refactor(compiler) turn compiler into a service
BREAK
- remove angular.compile() since the compile method is now a service and needs to be injected
2011-11-14 16:39:32 -08:00

25 lines
929 B
JavaScript

'use strict';
describe("ScenarioSpec: Compilation", function() {
describe('compilation', function() {
it("should compile dom node and return scope", inject(function($rootScope, $compile) {
var node = jqLite('<div ng:init="a=1">{{b=a+1}}</div>')[0];
$compile(node)($rootScope);
$rootScope.$digest();
expect($rootScope.a).toEqual(1);
expect($rootScope.b).toEqual(2);
}));
it("should compile jQuery node and return scope", inject(function($rootScope, $compile) {
var element = $compile(jqLite('<div>{{a=123}}</div>'))($rootScope);
$rootScope.$digest();
expect(jqLite(element).text()).toEqual('123');
}));
it("should compile text node and return scope", inject(function($rootScope, $compile) {
var element = $compile('<div>{{a=123}}</div>')($rootScope);
$rootScope.$digest();
expect(jqLite(element).text()).toEqual('123');
}));
});
});