Repository: angular/angular.js
File: test/ng/compileSpec.js (JavaScript)

Code before:
                    log.push(['$onChanges', changes.input]);
                  }
                };
              }
            });
        });

        it('should not update isolate again after $onInit if outer has not changed', function() {
          module('owComponentTest');
          inject(function() {
            $rootScope.name = 'outer';
            compile('<ow-component input="name"></ow-component>');

            expect($rootScope.name).toEqual('outer');
            expect(component.input).toEqual('$onInit');
            expect(log).toEqual([
              'constructor',
              ['$onChanges', jasmine.objectContaining({ currentValue: 'outer' })],
              '$onInit'
            ]);
          });
        });


        it('should update isolate again after $onInit if outer has changed (before initial watchAction call)', function() {
          module('owComponentTest');
          inject(function() {
            $rootScope.name = 'outer1';
            compile('<ow-component input="name"></ow-component>');

            expect(component.input).toEqual('$onInit');
            $rootScope.$apply('name = "outer2"');

            expect($rootScope.name).toEqual('outer2');
            expect(component.input).toEqual('outer2');
            expect(log).toEqual([
              'constructor',
              ['$onChanges', jasmine.objectContaining({ currentValue: 'outer1' })],
              '$onInit',
              ['$onChanges', jasmine.objectContaining({ currentValue: 'outer2', previousValue: 'outer1' })]
            ]);
          });
        });

        it('should update isolate again after $onInit if outer has changed (before initial watchAction call)', function() {
          angular.module('owComponentTest')
            .directive('changeInput', function() {
              return function(scope, elem, attrs) {
                scope.name = 'outer2';
              };
            });

Review comment (suggestion):
Wouldn't this test pass even without the fix ? (I haven't tested it, but I think so.)
I think it's a good idea to add a `$rootScope.$digest()` and another round of expectation to make sure that nothing is overwritten when the watch callback is executed.


Code after:
                    log.push(['$onChanges', changes.input]);
                  }
                };
              }
            });
        });

        it('should not update isolate again after $onInit if outer has not changed', function() {
          module('owComponentTest');
          inject(function() {
            $rootScope.name = 'outer';
            compile('<ow-component input="name"></ow-component>');

            expect($rootScope.name).toEqual('outer');
            expect(component.input).toEqual('$onInit');

            $rootScope.$apply();

            expect($rootScope.name).toEqual('outer');
            expect(component.input).toEqual('$onInit');

            expect(log).toEqual([
              'constructor',
              ['$onChanges', jasmine.objectContaining({ currentValue: 'outer' })],
              '$onInit'
            ]);
          });
        });

        it('should update isolate again after $onInit if outer has changed (before initial watchAction call)', function() {
          module('owComponentTest');
          inject(function() {
            $rootScope.name = 'outer1';
            compile('<ow-component input="name"></ow-component>');

            expect(component.input).toEqual('$onInit');
            $rootScope.$apply('name = "outer2"');

            expect($rootScope.name).toEqual('outer2');
            expect(component.input).toEqual('outer2');
            expect(log).toEqual([
              'constructor',
              ['$onChanges', jasmine.objectContaining({ currentValue: 'outer1' })],
              '$onInit',
              ['$onChanges', jasmine.objectContaining({ currentValue: 'outer2', previousValue: 'outer1' })]
            ]);
          });
        });

        it('should update isolate again after $onInit if outer has changed (before initial watchAction call)', function() {
          angular.module('owComponentTest')