blob: 5f83ab930539385242472b1afc09f8de1f289e90 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
'use strict';
describe("ScenarioSpec: Compilation", function() {
var scope;
beforeEach(function() {
scope = null;
});
afterEach(function() {
dealoc(scope);
});
describe('compilation', function() {
it("should compile dom node and return scope", function() {
var node = jqLite('<div ng:init="a=1">{{b=a+1}}</div>')[0];
scope = angular.compile(node)();
scope.$digest();
expect(scope.a).toEqual(1);
expect(scope.b).toEqual(2);
});
it("should compile jQuery node and return scope", function() {
scope = compile(jqLite('<div>{{a=123}}</div>'))();
scope.$digest();
expect(jqLite(scope.$element).text()).toEqual('123');
});
it("should compile text node and return scope", function() {
scope = angular.compile('<div>{{a=123}}</div>')();
scope.$digest();
expect(jqLite(scope.$element).text()).toEqual('123');
});
});
});
|