From 1616e9720df6edc4ab9955e31f2916bd1208da67 Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Mon, 13 Jun 2016 09:40:33 -0700 Subject: [PATCH] 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. Closes #5994 --- src/popover/popover.js | 13 +++++------ src/tooltip/test/tooltip.spec.js | 2 -- src/tooltip/tooltip.js | 24 +++++++++----------- template/popover/popover-html.html | 13 ++++------- template/popover/popover-template.html | 17 +++++--------- template/popover/popover.html | 13 ++++------- template/tooltip/tooltip-html-popup.html | 9 ++------ template/tooltip/tooltip-popup.html | 9 ++------ template/tooltip/tooltip-template-popup.html | 13 ++++------- 9 files changed, 39 insertions(+), 74 deletions(-) diff --git a/src/popover/popover.js b/src/popover/popover.js index af30188b24..df94a4c96f 100644 --- a/src/popover/popover.js +++ b/src/popover/popover.js @@ -7,9 +7,8 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) .directive('uibPopoverTemplatePopup', function() { return { - replace: true, - scope: { uibTitle: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', - originScope: '&' }, + restrict: 'A', + scope: { uibTitle: '@', contentExp: '&', originScope: '&' }, templateUrl: 'uib/template/popover/popover-template.html' }; }) @@ -22,8 +21,8 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) .directive('uibPopoverHtmlPopup', function() { return { - replace: true, - scope: { contentExp: '&', uibTitle: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, + restrict: 'A', + scope: { contentExp: '&', uibTitle: '@' }, templateUrl: 'uib/template/popover/popover-html.html' }; }) @@ -36,8 +35,8 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) .directive('uibPopoverPopup', function() { return { - replace: true, - scope: { uibTitle: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, + restrict: 'A', + scope: { uibTitle: '@', content: '@' }, templateUrl: 'uib/template/popover/popover.html' }; }) diff --git a/src/tooltip/test/tooltip.spec.js b/src/tooltip/test/tooltip.spec.js index ddb3a9a0c9..5fe92be409 100644 --- a/src/tooltip/test/tooltip.spec.js +++ b/src/tooltip/test/tooltip.spec.js @@ -179,7 +179,6 @@ describe('tooltip', function() { expect(elm.attr('alt')).toBe(scope.alt); ttScope = angular.element(elmBody.children()[1]).isolateScope(); - expect(ttScope.placement).toBe('top'); expect(ttScope.content).toBe(scope.tooltipMsg); trigger(elm, 'mouseleave'); @@ -188,7 +187,6 @@ describe('tooltip', function() { trigger(elm, 'mouseenter'); ttScope = angular.element(elmBody.children()[1]).isolateScope(); - expect(ttScope.placement).toBe('top'); expect(ttScope.content).toBe(scope.tooltipMsg); })); diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index 8b5f69767c..37006fb18d 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -126,12 +126,11 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s (options.useContentExp ? 'content-exp="contentExp()" ' : 'content="' + startSym + 'content' + endSym + '" ') + - 'placement="' + startSym + 'placement' + endSym + '" ' + - 'popup-class="' + startSym + 'popupClass' + endSym + '" ' + - 'animation="animation" ' + - 'is-open="isOpen" ' + 'origin-scope="origScope" ' + - 'class="uib-position-measure"' + + 'class="uib-position-measure ' + prefix + '" ' + + 'tooltip-animation-class="fade"' + + 'uib-tooltip-classes ' + + 'ng-class="{ in: isOpen }" ' + '>' + ''; @@ -667,7 +666,7 @@ function ($animate, $sce, $compile, $templateRequest) { element.addClass(scope.popupClass); } - if (scope.animation()) { + if (scope.animation) { element.addClass(attrs.tooltipAnimationClass); } } @@ -676,8 +675,8 @@ function ($animate, $sce, $compile, $templateRequest) { .directive('uibTooltipPopup', function() { return { - replace: true, - scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, + restrict: 'A', + scope: { content: '@' }, templateUrl: 'uib/template/tooltip/tooltip-popup.html' }; }) @@ -688,9 +687,8 @@ function ($animate, $sce, $compile, $templateRequest) { .directive('uibTooltipTemplatePopup', function() { return { - replace: true, - scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', - originScope: '&' }, + restrict: 'A', + scope: { contentExp: '&', originScope: '&' }, templateUrl: 'uib/template/tooltip/tooltip-template-popup.html' }; }) @@ -703,8 +701,8 @@ function ($animate, $sce, $compile, $templateRequest) { .directive('uibTooltipHtmlPopup', function() { return { - replace: true, - scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, + restrict: 'A', + scope: { contentExp: '&' }, templateUrl: 'uib/template/tooltip/tooltip-html-popup.html' }; }) diff --git a/template/popover/popover-html.html b/template/popover/popover-html.html index e127a0f2aa..722fd14a72 100644 --- a/template/popover/popover-html.html +++ b/template/popover/popover-html.html @@ -1,11 +1,6 @@ -
-
+
-
-

-
-
+
+

+
diff --git a/template/popover/popover-template.html b/template/popover/popover-template.html index 52d2c2fde6..6053b807c9 100644 --- a/template/popover/popover-template.html +++ b/template/popover/popover-template.html @@ -1,13 +1,8 @@ -
-
+
-
-

-
-
+
+

+
diff --git a/template/popover/popover.html b/template/popover/popover.html index a5cbdb5a06..60286c95c1 100644 --- a/template/popover/popover.html +++ b/template/popover/popover.html @@ -1,11 +1,6 @@ -
-
+
-
-

-
-
+
+

+
diff --git a/template/tooltip/tooltip-html-popup.html b/template/tooltip/tooltip-html-popup.html index 6ecef364c3..aaa1e81db2 100644 --- a/template/tooltip/tooltip-html-popup.html +++ b/template/tooltip/tooltip-html-popup.html @@ -1,7 +1,2 @@ -
-
-
-
+
+
diff --git a/template/tooltip/tooltip-popup.html b/template/tooltip/tooltip-popup.html index dbbda48517..e2dfc0873d 100644 --- a/template/tooltip/tooltip-popup.html +++ b/template/tooltip/tooltip-popup.html @@ -1,7 +1,2 @@ -
-
-
-
+
+
diff --git a/template/tooltip/tooltip-template-popup.html b/template/tooltip/tooltip-template-popup.html index be8e97950f..5059765954 100644 --- a/template/tooltip/tooltip-template-popup.html +++ b/template/tooltip/tooltip-template-popup.html @@ -1,9 +1,4 @@ -
-
-
-
+
+