Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(tooltip): remove child scope requirement
Browse files Browse the repository at this point in the history
tt_ scope variables are now in the ttScope which is specific to each
tooltip directive (multiple tooltip directives can now run on the same
element).

This allows tooltips to be used alongside any directive that may or
may not require different scope types.

Closes #1269
Fixes #2320
Fixes #2203
  • Loading branch information
chrisirhc committed Nov 5, 2014
1 parent e10d561 commit 8204c80
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 79 deletions.
10 changes: 6 additions & 4 deletions src/popover/test/popover.spec.js
Expand Up @@ -2,7 +2,8 @@ describe('popover', function() {
var elm,
elmBody,
scope,
elmScope;
elmScope,
tooltipScope;

// load the popover code
beforeEach(module('ui.bootstrap.popover'));
Expand All @@ -20,10 +21,11 @@ describe('popover', function() {
scope.$digest();
elm = elmBody.find('span');
elmScope = elm.scope();
tooltipScope = elmScope.$$childTail;
}));

it('should not be open initially', inject(function() {
expect( elmScope.tt_isOpen ).toBe( false );
expect( tooltipScope.isOpen ).toBe( false );

// We can only test *that* the popover-popup element wasn't created as the
// implementation is templated and replaced.
Expand All @@ -32,7 +34,7 @@ describe('popover', function() {

it('should open on click', inject(function() {
elm.trigger( 'click' );
expect( elmScope.tt_isOpen ).toBe( true );
expect( tooltipScope.isOpen ).toBe( true );

// We can only test *that* the popover-popup element was created as the
// implementation is templated and replaced.
Expand All @@ -42,7 +44,7 @@ describe('popover', function() {
it('should close on second click', inject(function() {
elm.trigger( 'click' );
elm.trigger( 'click' );
expect( elmScope.tt_isOpen ).toBe( false );
expect( tooltipScope.isOpen ).toBe( false );
}));

it('should not unbind event handlers created by other directives - issue 456', inject( function( $compile ) {
Expand Down

0 comments on commit 8204c80

Please sign in to comment.