aboutsummaryrefslogtreecommitdiffstats
path: root/test/AngularSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-10-25 22:21:21 -0700
committerMisko Hevery2011-11-14 16:39:32 -0800
commitd12df0d360fe0dabdca3591654327834bee2803b (patch)
tree605694ecc056869e9dd20283d8256c92655a44d4 /test/AngularSpec.js
parentd9b58f23f6b3fe5635c3ec5259e6a0002cff78b7 (diff)
downloadangular.js-d12df0d360fe0dabdca3591654327834bee2803b.tar.bz2
refactor(compiler) turn compiler into a service
BREAK - remove angular.compile() since the compile method is now a service and needs to be injected
Diffstat (limited to 'test/AngularSpec.js')
-rw-r--r--test/AngularSpec.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index eb64a825..7e6f35fa 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -423,7 +423,7 @@ describe('angular', function() {
describe('directive', function() {
- it('should register directives with case-insensitive id', function() {
+ it('should register directives with case-insensitive id', inject(function($compile) {
angularDirective('ALLCAPS', function(val, el) {el.text('+' + val + '+')});
angularDirective('lowercase', function(val, el) {el.text('-' + val + '-')});
@@ -433,14 +433,14 @@ describe('angular', function() {
'<span ALLCAPS="xx3"></span>' +
'<span lowerCASE="XX4">xx4</span>' +
'</div>');
- compile(el);
+ $compile(el);
expect(lowercase(sortedHtml(el))).toBe('<div>' +
'<span allcaps="xx1">+xx1+</span>' +
'<span allcaps="xx2">+xx2+</span>' +
'<span allcaps="xx3">+xx3+</span>' +
'<span lowercase="xx4">-xx4-</span>' +
'</div>');
- });
+ }));
});
@@ -458,25 +458,25 @@ describe('angular', function() {
});
describe('compile', function() {
- it('should link to existing node and create scope', inject(function($rootScope) {
+ it('should link to existing node and create scope', inject(function($rootScope, $compile) {
var template = angular.element('<div>{{greeting = "hello world"}}</div>');
- angular.compile(template)($rootScope);
+ $compile(template)($rootScope);
$rootScope.$digest();
expect(template.text()).toEqual('hello world');
expect($rootScope.greeting).toEqual('hello world');
}));
- it('should link to existing node and given scope', inject(function($rootScope) {
+ it('should link to existing node and given scope', inject(function($rootScope, $compile) {
var template = angular.element('<div>{{greeting = "hello world"}}</div>');
- angular.compile(template)($rootScope);
+ $compile(template)($rootScope);
$rootScope.$digest();
expect(template.text()).toEqual('hello world');
}));
- it('should link to new node and given scope', inject(function($rootScope) {
+ it('should link to new node and given scope', inject(function($rootScope, $compile) {
var template = jqLite('<div>{{greeting = "hello world"}}</div>');
- var templateFn = angular.compile(template);
+ var templateFn = $compile(template);
var templateClone = template.clone();
var element = templateFn($rootScope, function(clone){
@@ -490,9 +490,9 @@ describe('angular', function() {
expect($rootScope.greeting).toEqual('hello world');
}));
- it('should link to cloned node and create scope', inject(function($rootScope) {
+ it('should link to cloned node and create scope', inject(function($rootScope, $compile) {
var template = jqLite('<div>{{greeting = "hello world"}}</div>');
- var element = angular.compile(template)($rootScope, noop);
+ var element = $compile(template)($rootScope, noop);
$rootScope.$digest();
expect(template.text()).toEqual('');
expect(element.text()).toEqual('hello world');