fix(input): check scope.$$phase only on $rootScope

This commit is contained in:
Shahar Talmi
2014-08-29 23:32:21 +03:00
committed by Tobias Bosch
parent 9bf964f1f3
commit 36e6de1d91
2 changed files with 22 additions and 11 deletions

View File

@@ -580,19 +580,30 @@ describe('input', function() {
});
if (!_jqLiteMode) {
it('should not cause the double $digest when triggering an event using jQuery', function() {
$sniffer.hasEvent = function(eventName) {
return eventName !== 'input';
};
describe('double $digest when triggering an event using jQuery', function() {
function run() {
$sniffer.hasEvent = function(eventName) {
return eventName !== 'input';
};
compileInput('<input type="text" ng-model="name" name="alias" ng-change="change()" />');
compileInput('<input type="text" ng-model="name" name="alias" ng-change="change()" />');
scope.field = 'fake field';
scope.$watch('field', function() {
// We need to use _originalTrigger since trigger is modified by Angular Scenario.
inputElm._originalTrigger('change');
scope.field = 'fake field';
scope.$watch('field', function() {
// We need to use _originalTrigger since trigger is modified by Angular Scenario.
inputElm._originalTrigger('change');
});
scope.$apply();
}
it('should not cause the double $digest with non isolate scopes', function() {
run();
});
it('should not cause the double $digest with isolate scopes', function() {
scope = scope.$new(true);
run();
});
scope.$apply();
});
}
});