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

Commit 304f1f0

Browse files
committed
feat(tooltip): remove replace usage
- Remove `replace: true` usage BREAKING CHANGE: The template structure changed slightly due to the removal of `replace: true` - see documentation examples in action to see differences in practice.
1 parent 5fdcbd6 commit 304f1f0

9 files changed

+39
-74
lines changed

Diff for: src/popover/popover.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
77

88
.directive('uibPopoverTemplatePopup', function() {
99
return {
10-
replace: true,
11-
scope: { uibTitle: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
12-
originScope: '&' },
10+
restrict: 'A',
11+
scope: { uibTitle: '@', contentExp: '&', originScope: '&' },
1312
templateUrl: 'uib/template/popover/popover-template.html'
1413
};
1514
})
@@ -22,8 +21,8 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
2221

2322
.directive('uibPopoverHtmlPopup', function() {
2423
return {
25-
replace: true,
26-
scope: { contentExp: '&', uibTitle: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
24+
restrict: 'A',
25+
scope: { contentExp: '&', uibTitle: '@' },
2726
templateUrl: 'uib/template/popover/popover-html.html'
2827
};
2928
})
@@ -36,8 +35,8 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip'])
3635

3736
.directive('uibPopoverPopup', function() {
3837
return {
39-
replace: true,
40-
scope: { uibTitle: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
38+
restrict: 'A',
39+
scope: { uibTitle: '@', content: '@' },
4140
templateUrl: 'uib/template/popover/popover.html'
4241
};
4342
})

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

-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ describe('tooltip', function() {
179179
expect(elm.attr('alt')).toBe(scope.alt);
180180

181181
ttScope = angular.element(elmBody.children()[1]).isolateScope();
182-
expect(ttScope.placement).toBe('top');
183182
expect(ttScope.content).toBe(scope.tooltipMsg);
184183

185184
trigger(elm, 'mouseleave');
@@ -188,7 +187,6 @@ describe('tooltip', function() {
188187
trigger(elm, 'mouseenter');
189188

190189
ttScope = angular.element(elmBody.children()[1]).isolateScope();
191-
expect(ttScope.placement).toBe('top');
192190
expect(ttScope.content).toBe(scope.tooltipMsg);
193191
}));
194192

Diff for: src/tooltip/tooltip.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,11 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
126126
(options.useContentExp ?
127127
'content-exp="contentExp()" ' :
128128
'content="' + startSym + 'content' + endSym + '" ') +
129-
'placement="' + startSym + 'placement' + endSym + '" ' +
130-
'popup-class="' + startSym + 'popupClass' + endSym + '" ' +
131-
'animation="animation" ' +
132-
'is-open="isOpen" ' +
133129
'origin-scope="origScope" ' +
134-
'class="uib-position-measure"' +
130+
'class="uib-position-measure ' + prefix + '" ' +
131+
'tooltip-animation-class="fade"' +
132+
'uib-tooltip-classes ' +
133+
'ng-class="{ in: isOpen }" ' +
135134
'>' +
136135
'</div>';
137136

@@ -667,7 +666,7 @@ function ($animate, $sce, $compile, $templateRequest) {
667666
element.addClass(scope.popupClass);
668667
}
669668

670-
if (scope.animation()) {
669+
if (scope.animation) {
671670
element.addClass(attrs.tooltipAnimationClass);
672671
}
673672
}
@@ -676,8 +675,8 @@ function ($animate, $sce, $compile, $templateRequest) {
676675

677676
.directive('uibTooltipPopup', function() {
678677
return {
679-
replace: true,
680-
scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
678+
restrict: 'A',
679+
scope: { content: '@' },
681680
templateUrl: 'uib/template/tooltip/tooltip-popup.html'
682681
};
683682
})
@@ -688,9 +687,8 @@ function ($animate, $sce, $compile, $templateRequest) {
688687

689688
.directive('uibTooltipTemplatePopup', function() {
690689
return {
691-
replace: true,
692-
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&',
693-
originScope: '&' },
690+
restrict: 'A',
691+
scope: { contentExp: '&', originScope: '&' },
694692
templateUrl: 'uib/template/tooltip/tooltip-template-popup.html'
695693
};
696694
})
@@ -703,8 +701,8 @@ function ($animate, $sce, $compile, $templateRequest) {
703701

704702
.directive('uibTooltipHtmlPopup', function() {
705703
return {
706-
replace: true,
707-
scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' },
704+
restrict: 'A',
705+
scope: { contentExp: '&' },
708706
templateUrl: 'uib/template/tooltip/tooltip-html-popup.html'
709707
};
710708
})

Diff for: template/popover/popover-html.html

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
<div class="popover"
2-
tooltip-animation-class="fade"
3-
uib-tooltip-classes
4-
ng-class="{ in: isOpen() }">
5-
<div class="arrow"></div>
1+
<div class="arrow"></div>
62

7-
<div class="popover-inner">
8-
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
9-
<div class="popover-content" ng-bind-html="contentExp()"></div>
10-
</div>
3+
<div class="popover-inner">
4+
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
5+
<div class="popover-content" ng-bind-html="contentExp()"></div>
116
</div>

Diff for: template/popover/popover-template.html

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
<div class="popover"
2-
tooltip-animation-class="fade"
3-
uib-tooltip-classes
4-
ng-class="{ in: isOpen() }">
5-
<div class="arrow"></div>
1+
<div class="arrow"></div>
62

7-
<div class="popover-inner">
8-
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
9-
<div class="popover-content"
10-
uib-tooltip-template-transclude="contentExp()"
11-
tooltip-template-transclude-scope="originScope()"></div>
12-
</div>
3+
<div class="popover-inner">
4+
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
5+
<div class="popover-content"
6+
uib-tooltip-template-transclude="contentExp()"
7+
tooltip-template-transclude-scope="originScope()"></div>
138
</div>

Diff for: template/popover/popover.html

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
<div class="popover"
2-
tooltip-animation-class="fade"
3-
uib-tooltip-classes
4-
ng-class="{ in: isOpen() }">
5-
<div class="arrow"></div>
1+
<div class="arrow"></div>
62

7-
<div class="popover-inner">
8-
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
9-
<div class="popover-content" ng-bind="content"></div>
10-
</div>
3+
<div class="popover-inner">
4+
<h3 class="popover-title" ng-bind="uibTitle" ng-if="uibTitle"></h3>
5+
<div class="popover-content" ng-bind="content"></div>
116
</div>

Diff for: template/tooltip/tooltip-html-popup.html

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
<div class="tooltip"
2-
tooltip-animation-class="fade"
3-
uib-tooltip-classes
4-
ng-class="{ in: isOpen() }">
5-
<div class="tooltip-arrow"></div>
6-
<div class="tooltip-inner" ng-bind-html="contentExp()"></div>
7-
</div>
1+
<div class="tooltip-arrow"></div>
2+
<div class="tooltip-inner" ng-bind-html="contentExp()"></div>

Diff for: template/tooltip/tooltip-popup.html

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
<div class="tooltip"
2-
tooltip-animation-class="fade"
3-
uib-tooltip-classes
4-
ng-class="{ in: isOpen() }">
5-
<div class="tooltip-arrow"></div>
6-
<div class="tooltip-inner" ng-bind="content"></div>
7-
</div>
1+
<div class="tooltip-arrow"></div>
2+
<div class="tooltip-inner" ng-bind="content"></div>

Diff for: template/tooltip/tooltip-template-popup.html

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
<div class="tooltip"
2-
tooltip-animation-class="fade"
3-
uib-tooltip-classes
4-
ng-class="{ in: isOpen() }">
5-
<div class="tooltip-arrow"></div>
6-
<div class="tooltip-inner"
7-
uib-tooltip-template-transclude="contentExp()"
8-
tooltip-template-transclude-scope="originScope()"></div>
9-
</div>
1+
<div class="tooltip-arrow"></div>
2+
<div class="tooltip-inner"
3+
uib-tooltip-template-transclude="contentExp()"
4+
tooltip-template-transclude-scope="originScope()"></div>

0 commit comments

Comments
 (0)