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

Commit 2b68bcc

Browse files
committed
test(ngOptions): ignore comments within a <select> element
ngOptions should ignore comments within a `<select>`element and keep only the `<!-- ngIf -->` comment of the empty option. Ref #15812
1 parent eb3661c commit 2b68bcc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/ng/directive/ngOptionsSpec.js

+17
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,23 @@ describe('ngOptions', function() {
26412641
dealoc(element);
26422642
}));
26432643

2644+
2645+
it('should ignore the comments within the select', function() {
2646+
scope.values = [
2647+
{name:'black'},
2648+
{name:'white'},
2649+
{name:'red'}
2650+
];
2651+
scope.isBlank = true;
2652+
2653+
createSingleSelect('<!-- test comment --><option ng-if="isBlank" value="">blank</option><!-- test comment 2 -->');
2654+
scope.$apply();
2655+
2656+
expect(element.find('option')[0].value).toBe('');
2657+
expect(element.find('option')[0].textContent).toBe('blank');
2658+
expect(element.find('option')[1].textContent).toBe('black');
2659+
});
2660+
26442661
});
26452662

26462663

0 commit comments

Comments
 (0)