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

Commit 2ec5c07

Browse files
committed
test(ngOptions): ensure options aren't repainted when initialize ngOptions
Since 97b3e00, ngOptions are repainting the options twice when it initializes. This test verifies that the options arent unnecessarily repainted. Ref #15812
1 parent 2b68bcc commit 2ec5c07

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
@@ -779,6 +779,23 @@ describe('ngOptions', function() {
779779
expect(options[2]).not.toBeMarkedAsSelected();
780780
});
781781

782+
783+
it('should render the options only one time', function() {
784+
scope.values = ['black', 'white', 'red'];
785+
createSelect({
786+
'ng-model': 'value'
787+
});
788+
789+
element.attr('ng-options', 'value for value in values');
790+
var repaint = 0;
791+
element[0].addEventListener('DOMSubtreeModified', function(ev) {
792+
repaint++;
793+
expect(repaint).toBeLessThan(2);
794+
});
795+
796+
$compile(element)(scope);
797+
});
798+
782799
describe('disableWhen expression', function() {
783800

784801
describe('on single select', function() {

0 commit comments

Comments
 (0)