aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/compileSpec.js
diff options
context:
space:
mode:
authorIgor Minar2012-05-02 16:34:54 -0700
committerIgor Minar2012-05-03 00:15:26 -0700
commitbd530e225750e9b30b6300fc3d7447a5f1071667 (patch)
tree1e714d634691fa13af55163b038d2d276a9dfb42 /test/ng/compileSpec.js
parent843f762c573e38a044f920c5575c6feb46bc7226 (diff)
downloadangular.js-bd530e225750e9b30b6300fc3d7447a5f1071667.tar.bz2
chore($compile): remove obsolete <<CONTENT>> transclusion
This stuff was never documented and is an accidental leftover from the time when the compiler was rewritten. If any code depends on this, it should be rewritten to use ngTransclude directive intead.
Diffstat (limited to 'test/ng/compileSpec.js')
-rw-r--r--test/ng/compileSpec.js54
1 files changed, 30 insertions, 24 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 54837bf7..74eaec8a 100644
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -364,7 +364,7 @@ describe('$compile', function() {
$compileProvider.directive('replace', valueFn({
restrict: 'CAM',
replace: true,
- template: '<div class="log" style="width: 10px" high-log>Hello: <<CONTENT>></div>',
+ template: '<div class="log" style="width: 10px" high-log>Replace!</div>',
compile: function(element, attr) {
attr.$set('compiled', 'COMPILED');
expect(element).toBe(attr.$$element);
@@ -372,7 +372,7 @@ describe('$compile', function() {
}));
$compileProvider.directive('append', valueFn({
restrict: 'CAM',
- template: '<div class="log" style="width: 10px" high-log>Hello: <<CONTENT>></div>',
+ template: '<div class="log" style="width: 10px" high-log>Append!</div>',
compile: function(element, attr) {
attr.$set('compiled', 'COMPILED');
expect(element).toBe(attr.$$element);
@@ -382,34 +382,34 @@ describe('$compile', function() {
it('should replace element with template', inject(function($compile, $rootScope) {
- element = $compile('<div><div replace>content</div><div>')($rootScope);
- expect(element.text()).toEqual('Hello: content');
+ element = $compile('<div><div replace>ignore</div><div>')($rootScope);
+ expect(element.text()).toEqual('Replace!');
expect(element.find('div').attr('compiled')).toEqual('COMPILED');
}));
it('should append element with template', inject(function($compile, $rootScope) {
- element = $compile('<div><div append>content</div><div>')($rootScope);
- expect(element.text()).toEqual('Hello: content');
+ element = $compile('<div><div append>ignore</div><div>')($rootScope);
+ expect(element.text()).toEqual('Append!');
expect(element.find('div').attr('compiled')).toEqual('COMPILED');
}));
- it('should compile replace template', inject(function($compile, $rootScope, log) {
- element = $compile('<div><div replace medium-log>{{ "angular" }}</div><div>')
+ it('should compile template when replacing', inject(function($compile, $rootScope, log) {
+ element = $compile('<div><div replace medium-log>ignore</div><div>')
($rootScope);
$rootScope.$digest();
- expect(element.text()).toEqual('Hello: angular');
+ expect(element.text()).toEqual('Replace!');
// HIGH goes after MEDIUM since it executes as part of replaced template
expect(log).toEqual('MEDIUM; HIGH; LOG');
}));
- it('should compile append template', inject(function($compile, $rootScope, log) {
- element = $compile('<div><div append medium-log>{{ "angular" }}</div><div>')
+ it('should compile template when appending', inject(function($compile, $rootScope, log) {
+ element = $compile('<div><div append medium-log>ignore</div><div>')
($rootScope);
$rootScope.$digest();
- expect(element.text()).toEqual('Hello: angular');
+ expect(element.text()).toEqual('Append!');
expect(log).toEqual('HIGH; LOG; MEDIUM');
}));
@@ -436,23 +436,23 @@ describe('$compile', function() {
}
}));
- it('should play nice with repeater when inline', inject(function($compile, $rootScope) {
+ it('should play nice with repeater when replacing', inject(function($compile, $rootScope) {
element = $compile(
'<div>' +
- '<div ng-repeat="i in [1,2]" replace>{{i}}; </div>' +
+ '<div ng-repeat="i in [1,2]" replace></div>' +
'</div>')($rootScope);
$rootScope.$digest();
- expect(element.text()).toEqual('Hello: 1; Hello: 2; ');
+ expect(element.text()).toEqual('Replace!Replace!');
}));
- it('should play nice with repeater when append', inject(function($compile, $rootScope) {
+ it('should play nice with repeater when appending', inject(function($compile, $rootScope) {
element = $compile(
'<div>' +
- '<div ng-repeat="i in [1,2]" append>{{i}}; </div>' +
+ '<div ng-repeat="i in [1,2]" append></div>' +
'</div>')($rootScope);
$rootScope.$digest();
- expect(element.text()).toEqual('Hello: 1; Hello: 2; ');
+ expect(element.text()).toEqual('Append!Append!');
}));
@@ -494,8 +494,12 @@ describe('$compile', function() {
beforeEach(module(
function($compileProvider) {
- $compileProvider.directive('hello', valueFn({ restrict: 'CAM', templateUrl: 'hello.html' }));
- $compileProvider.directive('cau', valueFn({ restrict: 'CAM', templateUrl:'cau.html' }));
+ $compileProvider.directive('hello', valueFn({
+ restrict: 'CAM', templateUrl: 'hello.html', transclude: true
+ }));
+ $compileProvider.directive('cau', valueFn({
+ restrict: 'CAM', templateUrl:'cau.html'
+ }));
$compileProvider.directive('cError', valueFn({
restrict: 'CAM',
@@ -930,9 +934,10 @@ describe('$compile', function() {
}));
- it('should work when widget is in root element', inject(
+ it('should work when directive is on the root element', inject(
function($compile, $httpBackend, $rootScope) {
- $httpBackend.expect('GET', 'hello.html').respond('<span>3==<<content>></span>');
+ $httpBackend.expect('GET', 'hello.html').
+ respond('<span>3==<span ng-transclude></span></span>');
element = jqLite('<b class="hello">{{1+2}}</b>');
$compile(element)($rootScope);
@@ -942,9 +947,10 @@ describe('$compile', function() {
));
- it('should work when widget is a repeater', inject(
+ it('should work when directive is a repeater', inject(
function($compile, $httpBackend, $rootScope) {
- $httpBackend.expect('GET', 'hello.html').respond('<span>i=<<content>>;</span>');
+ $httpBackend.expect('GET', 'hello.html').
+ respond('<span>i=<span ng-transclude></span>;</span>');
element = jqLite('<div><b class=hello ng-repeat="i in [1,2]">{{i}}</b></div>');
$compile(element)($rootScope);