From 7ddbde8c1c00e08a63de9701e29bf5e8bed051b8 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Mon, 25 Feb 2013 20:43:27 -0800 Subject: [PATCH] chore(sortedHtml): print attributes with empty value I had to also fix some tests as they started failing on IE8. We should figure out why these extra attributes are set in IE8, but I'm too tired of IE to worry about it now. Since I'm not introducing this issue just making it visible, I'm going to commit this as is. --- test/ng/compileSpec.js | 28 ++++++++++++++++++---------- test/testabilityPatch.js | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index ae1eb000ea67..a03ad929a980 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -741,12 +741,16 @@ describe('$compile', function() { $rootScope.$digest(); - expect(sortedHtml(element)). - toEqual('
Cau!
'); + expect(sortedHtml(element)).toBeOneOf( + '
Cau!
', + '
Cau!
' //ie8 + ); $httpBackend.flush(); - expect(sortedHtml(element)). - toEqual('
Hello!Cau!
'); + expect(sortedHtml(element)).toBeOneOf( + '
Hello!Cau!
', + '
Hello!Cau!
' //ie8 + ); } )); @@ -773,8 +777,10 @@ describe('$compile', function() { $rootScope.$digest(); - expect(sortedHtml(element)). - toEqual('
Hello, Elvis!
'); + expect(sortedHtml(element)).toBeOneOf( + '
Hello, Elvis!
', + '
Hello, Elvis!
' //ie8 + ); } )); @@ -803,8 +809,10 @@ describe('$compile', function() { element = template($rootScope); $rootScope.$digest(); - expect(sortedHtml(element)). - toEqual('
Hello, Elvis!
'); + expect(sortedHtml(element)).toBeOneOf( + '
Hello, Elvis!
', + '
Hello, Elvis!
' //ie8 + ); } )); @@ -1491,13 +1499,13 @@ describe('$compile', function() { $rootScope.$digest(); expect(sortedHtml(element).replace(' selected="true"', '')). toEqual(''); $rootScope.name = 'Misko'; $rootScope.$digest(); expect(sortedHtml(element).replace(' selected="true"', '')). toEqual(''); })); diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index d55ff0159ca3..cef009933712 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -114,7 +114,7 @@ function sortedHtml(element, showNgClass) { var attr = attributes[i]; if(attr.name.match(/^ng[\:\-]/) || - attr.value && + (attr.value || attr.value == '') && attr.value !='null' && attr.value !='auto' && attr.value !='false' &&