aboutsummaryrefslogtreecommitdiffstats
path: root/test/CompilerSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2010-10-26 22:02:24 -0700
committerMisko Hevery2010-10-27 15:42:46 -0700
commit62c0e5c46091d8b98a20c31ab26e715bad574bae (patch)
tree18e73b82cb9017b9e9b66d3ec094c53ce0b633a8 /test/CompilerSpec.js
parentc67af8a03819004c4aaa775805badd1e631af738 (diff)
downloadangular.js-62c0e5c46091d8b98a20c31ab26e715bad574bae.tar.bz2
Fix failing tests for ie, and mark elements as ng-widget, ng-directive, and ng-binding
Diffstat (limited to 'test/CompilerSpec.js')
-rw-r--r--test/CompilerSpec.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js
index 59c365e4..780fd7cb 100644
--- a/test/CompilerSpec.js
+++ b/test/CompilerSpec.js
@@ -46,6 +46,7 @@ describe('compiler', function(){
var init = template(e).$init;
expect(log).toEqual("found");
init();
+ expect(e.hasClass('ng-directive')).toEqual(true);
expect(log).toEqual("found:init");
});
@@ -102,12 +103,13 @@ describe('compiler', function(){
}
});
var scope = compile('before<span>middle</span>after');
- expect(lowercase(scope.$element[0].innerHTML)).toEqual('before<span hello="middle">replaced</span>after');
+ expect(sortedHtml(scope.$element[0], true)).toEqual('<div>before<span class="ng-directive" hello="middle">replaced</span>after</div>');
expect(log).toEqual("hello middle");
});
it('should replace widgets', function(){
widgets['NG:BUTTON'] = function(element) {
+ expect(element.hasClass('ng-widget')).toEqual(true);
element.replaceWith('<div>button</div>');
return function(element) {
log += 'init';
@@ -120,6 +122,8 @@ describe('compiler', function(){
it('should use the replaced element after calling widget', function(){
widgets['H1'] = function(element) {
+ // HTML elements which are augmented by acting as widgets, should not be marked as so
+ expect(element.hasClass('ng-widget')).toEqual(false);
var span = angular.element('<span>{{1+2}}</span>');
element.replaceWith(span);
this.descend(true);