Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit e281413

Browse files
committedFeb 26, 2013
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.
1 parent 2007ddd commit e281413

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed
 

‎test/ng/compileSpec.js

+18-10
Original file line numberDiff line numberDiff line change
@@ -741,12 +741,16 @@ describe('$compile', function() {
741741
$rootScope.$digest();
742742

743743

744-
expect(sortedHtml(element)).
745-
toEqual('<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>');
744+
expect(sortedHtml(element)).toBeOneOf(
745+
'<div><b class="i-hello"></b><span class="i-cau">Cau!</span></div>',
746+
'<div><b class="i-hello"></b><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
747+
);
746748

747749
$httpBackend.flush();
748-
expect(sortedHtml(element)).
749-
toEqual('<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>');
750+
expect(sortedHtml(element)).toBeOneOf(
751+
'<div><span class="i-hello">Hello!</span><span class="i-cau">Cau!</span></div>',
752+
'<div><span class="i-hello" i-hello="">Hello!</span><span class="i-cau" i-cau="">Cau!</span></div>' //ie8
753+
);
750754
}
751755
));
752756

@@ -773,8 +777,10 @@ describe('$compile', function() {
773777

774778
$rootScope.$digest();
775779

776-
expect(sortedHtml(element)).
777-
toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
780+
expect(sortedHtml(element)).toBeOneOf(
781+
'<div><span class="i-hello">Hello, Elvis!</span></div>',
782+
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
783+
);
778784
}
779785
));
780786

@@ -803,8 +809,10 @@ describe('$compile', function() {
803809
element = template($rootScope);
804810
$rootScope.$digest();
805811

806-
expect(sortedHtml(element)).
807-
toEqual('<div><span class="i-hello">Hello, Elvis!</span></div>');
812+
expect(sortedHtml(element)).toBeOneOf(
813+
'<div><span class="i-hello">Hello, Elvis!</span></div>',
814+
'<div><span class="i-hello" i-hello="">Hello, Elvis!</span></div>' //ie8
815+
);
808816
}
809817
));
810818

@@ -1490,13 +1498,13 @@ describe('$compile', function() {
14901498
$rootScope.$digest();
14911499
expect(sortedHtml(element).replace(' selected="true"', '')).
14921500
toEqual('<select ng:model="x">' +
1493-
'<option>Greet !</option>' +
1501+
'<option value="">Greet !</option>' +
14941502
'</select>');
14951503
$rootScope.name = 'Misko';
14961504
$rootScope.$digest();
14971505
expect(sortedHtml(element).replace(' selected="true"', '')).
14981506
toEqual('<select ng:model="x">' +
1499-
'<option>Greet Misko!</option>' +
1507+
'<option value="">Greet Misko!</option>' +
15001508
'</select>');
15011509
}));
15021510

‎test/testabilityPatch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function sortedHtml(element, showNgClass) {
114114

115115
var attr = attributes[i];
116116
if(attr.name.match(/^ng[\:\-]/) ||
117-
attr.value &&
117+
(attr.value || attr.value == '') &&
118118
attr.value !='null' &&
119119
attr.value !='auto' &&
120120
attr.value !='false' &&

0 commit comments

Comments
 (0)