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

Commit cca1460

Browse files
committed
fix(popover): rename title attribute
- Using an attribute of title on the tooltip template was causing the browser tooltip to display. Fixes #5719 Closes #5721
1 parent c83d0a8 commit cca1460

File tree

8 files changed

+72
-10
lines changed

8 files changed

+72
-10
lines changed

src/popover/popover.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
88
.directive('uibPopoverTemplatePopup', function() {
99
return {
1010
replace: true,
11-
scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
11+
scope: { uibTitle: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
1212
originScope: '&' },
1313
templateUrl: 'uib/template/popover/popover-template.html'
1414
};
@@ -23,7 +23,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
2323
.directive('uibPopoverHtmlPopup', function() {
2424
return {
2525
replace: true,
26-
scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
26+
scope: { contentExp: '&', uibTitle: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
2727
templateUrl: 'uib/template/popover/popover-html.html'
2828
};
2929
})
@@ -37,7 +37,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
3737
.directive('uibPopoverPopup', function() {
3838
return {
3939
replace: true,
40-
scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
40+
scope: { uibTitle: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
4141
templateUrl: 'uib/template/popover/popover.html'
4242
};
4343
})

src/popover/test/popover-html.spec.js

+16
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,22 @@ describe('popover', function() {
147147
expect(elmBody.children().eq(1)).not.toHaveClass('fade');
148148
}));
149149

150+
it ('should display the title', inject(function($compile) {
151+
elmBody = angular.element(
152+
'<div><span uib-popover-html="template" popover-title="popover title">Selector Text</span></div>'
153+
);
154+
155+
$compile(elmBody)(scope);
156+
scope.$digest();
157+
elm = elmBody.find('span');
158+
159+
elm.trigger('click');
160+
scope.$digest();
161+
162+
var titleEl = elmBody.find('.popover-title');
163+
expect(titleEl.text()).toBe('popover title');
164+
}));
165+
150166
describe('supports options', function() {
151167
describe('placement', function() {
152168
it('can specify an alternative, valid placement', inject(function($compile) {

src/popover/test/popover-template.spec.js

+16
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ describe('popover template', function() {
8686
expect(elmBody.children().length).toBe(1);
8787
}));
8888

89+
it ('should display the title', inject(function($compile) {
90+
elmBody = angular.element(
91+
'<div><span uib-popover-template="templateUrl" popover-title="popover title">Selector Text</span></div>'
92+
);
93+
94+
$compile(elmBody)(scope);
95+
scope.$digest();
96+
elm = elmBody.find('span');
97+
98+
elm.trigger('click');
99+
scope.$digest();
100+
101+
var titleEl = elmBody.find('.popover-title');
102+
expect(titleEl.text()).toBe('popover title');
103+
}));
104+
89105
describe('supports options', function() {
90106
describe('placement', function() {
91107
it('can specify an alternative, valid placement', inject(function($compile) {

src/popover/test/popover.spec.js

+30
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,36 @@ describe('popover', function() {
103103
expect(elmBody.children().eq(1)).not.toHaveClass('fade');
104104
}));
105105

106+
it ('should display the title', inject(function($compile) {
107+
elmBody = angular.element(
108+
'<div><span uib-popover="popover text" popover-title="popover title">Trigger here</span></div>'
109+
);
110+
$compile(elmBody)(scope);
111+
scope.$digest();
112+
113+
elm = elmBody.find('span');
114+
elm.trigger('click');
115+
scope.$digest();
116+
117+
var titleEl = elmBody.find('.popover-title');
118+
expect(titleEl.text()).toBe('popover title');
119+
}));
120+
121+
it ('should display the content', inject(function($compile) {
122+
elmBody = angular.element(
123+
'<div><span uib-popover="popover text" popover-title="popover title">Trigger here</span></div>'
124+
);
125+
$compile(elmBody)(scope);
126+
scope.$digest();
127+
128+
elm = elmBody.find('span');
129+
elm.trigger('click');
130+
scope.$digest();
131+
132+
var contentEl = elmBody.find('.popover-content');
133+
expect(contentEl.text()).toBe('popover text');
134+
}));
135+
106136
describe('supports options', function() {
107137
describe('placement', function() {
108138
it('can specify an alternative, valid placement', inject(function($compile) {

src/tooltip/tooltip.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
121121
var startSym = $interpolate.startSymbol();
122122
var endSym = $interpolate.endSymbol();
123123
var template =
124-
'<div '+ directiveName + '-popup '+
125-
'title="' + startSym + 'title' + endSym + '" '+
124+
'<div '+ directiveName + '-popup ' +
125+
'uib-title="' + startSym + 'title' + endSym + '" ' +
126126
(options.useContentExp ?
127127
'content-exp="contentExp()" ' :
128128
'content="' + startSym + 'content' + endSym + '" ') +
129-
'placement="' + startSym + 'placement' + endSym + '" '+
130-
'popup-class="' + startSym + 'popupClass' + endSym + '" '+
129+
'placement="' + startSym + 'placement' + endSym + '" ' +
130+
'popup-class="' + startSym + 'popupClass' + endSym + '" ' +
131131
'animation="animation" ' +
132132
'is-open="isOpen" ' +
133133
'origin-scope="origScope" ' +

template/popover/popover-html.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="arrow"></div>
66

77
<div class="popover-inner">
8-
<h3 class="popover-title" ng-bind="title" ng-if="title"></h3>
8+
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
99
<div class="popover-content" ng-bind-html="contentExp()"></div>
1010
</div>
1111
</div>

template/popover/popover-template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="arrow"></div>
66

77
<div class="popover-inner">
8-
<h3 class="popover-title" ng-bind="title" ng-if="title"></h3>
8+
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
99
<div class="popover-content"
1010
uib-tooltip-template-transclude="contentExp()"
1111
tooltip-template-transclude-scope="originScope()"></div>

template/popover/popover.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="arrow"></div>
66

77
<div class="popover-inner">
8-
<h3 class="popover-title" ng-bind="title" ng-if="title"></h3>
8+
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
99
<div class="popover-content" ng-bind="content"></div>
1010
</div>
1111
</div>

0 commit comments

Comments
 (0)