diff --git a/src/tooltip/test/tooltip.spec.js b/src/tooltip/test/tooltip.spec.js index 01f6423fe7..b2aeba9a92 100644 --- a/src/tooltip/test/tooltip.spec.js +++ b/src/tooltip/test/tooltip.spec.js @@ -98,7 +98,7 @@ describe('tooltip', function() { scope.alt = "Alt Message"; elmBody = $compile( angular.element( - '
Selector Text
' + '
Selector Text
' ) )( scope ); $compile( elmBody )( scope ); @@ -114,6 +114,13 @@ describe('tooltip', function() { expect( ttScope.content ).toBe( scope.tooltipMsg ); elm.trigger( 'mouseleave' ); + + //Isolate scope contents should be the same after hiding and showing again (issue 1191) + elm.trigger( 'mouseenter' ); + + ttScope = angular.element( elmBody.children()[1] ).scope(); + expect( ttScope.placement ).toBe( 'top' ); + expect( ttScope.content ).toBe( scope.tooltipMsg ); })); it('should not show tooltips if there is nothing to show - issue #129', inject(function ($compile) { @@ -136,6 +143,24 @@ describe('tooltip', function() { expect( elmBody.children().length ).toBe( 0 ); })); + it('issue 1191 - isolate scope on the popup should always be child of correct element scope', inject( function ( $compile ) { + var ttScope; + elm.trigger( 'mouseenter' ); + + ttScope = angular.element( elmBody.children()[1] ).scope(); + expect( ttScope.$parent ).toBe( elmScope ); + + elm.trigger( 'mouseleave' ); + + // After leaving and coming back, the scope's parent should be the same + elm.trigger( 'mouseenter' ); + + ttScope = angular.element( elmBody.children()[1] ).scope(); + expect( ttScope.$parent ).toBe( elmScope ); + + elm.trigger( 'mouseleave' ); + })); + describe('with specified enable expression', function() { beforeEach(inject(function ($compile) {