test(select): add test of updating the model because of ng-change

A regression #7855 was introduced by
dc149de936
This test ensures that reverting that commit fixes this regression.
In the regression, changes to a bound model in ng-change were not propagated back to the view.

Test for #7855
This commit is contained in:
Erin Altenhof-Long
2014-07-16 15:11:52 -07:00
committed by Peter Bacon Darwin
parent f92f52e29d
commit 48568b49dc

View File

@@ -1148,6 +1148,31 @@ describe('select', function() {
browserTrigger(element, 'change');
expect(scope.selected).toEqual(null);
});
// Regression https://github.com/angular/angular.js/issues/7855
it('should update the model with ng-change', function() {
createSelect({
'ng-change':'change()',
'ng-model':'selected',
'ng-options':'value for value in values'
});
scope.$apply(function() {
scope.values = ['A', 'B'];
scope.selected = 'A';
});
scope.change = function() {
scope.selected = 'A';
};
element.find('option')[1].selected = true;
browserTrigger(element, 'change');
expect(element.find('option')[0].selected).toBeTruthy();
expect(scope.selected).toEqual('A');
});
});
describe('disabled blank', function() {
@@ -1237,6 +1262,7 @@ describe('select', function() {
expect(scope.selected).toEqual([scope.values[0]]);
});
it('should select from object', function() {
createSelect({
'ng-model':'selected',