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

Commit 8204c80

Browse files
committed
fix(tooltip): remove child scope requirement
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
1 parent e10d561 commit 8204c80

File tree

3 files changed

+102
-79
lines changed

3 files changed

+102
-79
lines changed

src/popover/test/popover.spec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ describe('popover', function() {
22
var elm,
33
elmBody,
44
scope,
5-
elmScope;
5+
elmScope,
6+
tooltipScope;
67

78
// load the popover code
89
beforeEach(module('ui.bootstrap.popover'));
@@ -20,10 +21,11 @@ describe('popover', function() {
2021
scope.$digest();
2122
elm = elmBody.find('span');
2223
elmScope = elm.scope();
24+
tooltipScope = elmScope.$$childTail;
2325
}));
2426

2527
it('should not be open initially', inject(function() {
26-
expect( elmScope.tt_isOpen ).toBe( false );
28+
expect( tooltipScope.isOpen ).toBe( false );
2729

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

3335
it('should open on click', inject(function() {
3436
elm.trigger( 'click' );
35-
expect( elmScope.tt_isOpen ).toBe( true );
37+
expect( tooltipScope.isOpen ).toBe( true );
3638

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

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

0 commit comments

Comments
 (0)