Skip to content

Commit 0692c0f

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 angular-ui#1269 Fixes angular-ui#2320 Fixes angular-ui#2203
1 parent a65bea9 commit 0692c0f

File tree

3 files changed

+101
-79
lines changed

3 files changed

+101
-79
lines changed

Diff for: src/popover/test/popover.spec.js

+6-4
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)