diff --git a/src/popover/popover.js b/src/popover/popover.js index bc460864ca..5386a838e7 100644 --- a/src/popover/popover.js +++ b/src/popover/popover.js @@ -10,10 +10,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) replace: true, scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', originScope: '&' }, - templateUrl: 'template/popover/popover-template.html', - link: function(scope, element) { - element.addClass('popover'); - } + templateUrl: 'template/popover/popover-template.html' }; }) @@ -27,10 +24,7 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) return { replace: true, scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/popover/popover-html.html', - link: function(scope, element) { - element.addClass('popover'); - } + templateUrl: 'template/popover/popover-html.html' }; }) @@ -44,82 +38,10 @@ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) return { replace: true, scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/popover/popover.html', - link: function(scope, element) { - element.addClass('popover'); - } + templateUrl: 'template/popover/popover.html' }; }) .directive('uibPopover', ['$uibTooltip', function($uibTooltip) { return $uibTooltip('uibPopover', 'popover', 'click'); }]); - -/* Deprecated popover below */ - -angular.module('ui.bootstrap.popover') - -.value('$popoverSuppressWarning', false) - -.directive('popoverTemplatePopup', ['$log', '$popoverSuppressWarning', function($log, $popoverSuppressWarning) { - return { - replace: true, - scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', - originScope: '&' }, - templateUrl: 'template/popover/popover-template.html', - link: function(scope, element) { - if (!$popoverSuppressWarning) { - $log.warn('popover-template-popup is now deprecated. Use uib-popover-template-popup instead.'); - } - - element.addClass('popover'); - } - }; -}]) - -.directive('popoverTemplate', ['$tooltip', function($tooltip) { - return $tooltip('popoverTemplate', 'popover', 'click', { - useContentExp: true - }); -}]) - -.directive('popoverHtmlPopup', ['$log', '$popoverSuppressWarning', function($log, $popoverSuppressWarning) { - return { - replace: true, - scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/popover/popover-html.html', - link: function(scope, element) { - if (!$popoverSuppressWarning) { - $log.warn('popover-html-popup is now deprecated. Use uib-popover-html-popup instead.'); - } - - element.addClass('popover'); - } - }; -}]) - -.directive('popoverHtml', ['$tooltip', function($tooltip) { - return $tooltip('popoverHtml', 'popover', 'click', { - useContentExp: true - }); -}]) - -.directive('popoverPopup', ['$log', '$popoverSuppressWarning', function($log, $popoverSuppressWarning) { - return { - replace: true, - scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/popover/popover.html', - link: function(scope, element) { - if (!$popoverSuppressWarning) { - $log.warn('popover-popup is now deprecated. Use uib-popover-popup instead.'); - } - - element.addClass('popover'); - } - }; -}]) - -.directive('popover', ['$tooltip', function($tooltip) { - - return $tooltip('popover', 'popover', 'click'); -}]); diff --git a/src/popover/test/popover-html.spec.js b/src/popover/test/popover-html.spec.js index 9c59daabde..dd36149e7f 100644 --- a/src/popover/test/popover-html.spec.js +++ b/src/popover/test/popover-html.spec.js @@ -187,64 +187,3 @@ describe('popover', function() { }); }); }); - -/* Deprecation tests below */ - -describe('popover deprecation', function() { - beforeEach(module('ui.bootstrap.popover')); - beforeEach(module('template/popover/popover-html.html')); - - var elm, elmBody, elmScope, tooltipScope; - - function trigger(element, evt) { - evt = new Event(evt); - - element[0].dispatchEvent(evt); - element.scope().$$childTail.$digest(); - } - - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$popoverSuppressWarning', true); - $provide.value('$tooltipSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope, $sce) { - spyOn($log, 'warn'); - - $rootScope.html = 'I say: Hello!'; - $rootScope.safeHtml = $sce.trustAsHtml($rootScope.html); - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - trigger(elm, 'mouseenter'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(0); - }); - }); - - it('should give warning by default', inject(function($compile, $log, $rootScope, $sce) { - spyOn($log, 'warn'); - - $rootScope.html = 'I say: Hello!'; - $rootScope.safeHtml = $sce.trustAsHtml($rootScope.html); - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - elm.trigger('click'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(2); - expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']); - expect($log.warn.calls.argsFor(1)).toEqual(['popover-html-popup is now deprecated. Use uib-popover-html-popup instead.']); - })); -}); diff --git a/src/popover/test/popover-template.spec.js b/src/popover/test/popover-template.spec.js index 347f869acf..de69d343ec 100644 --- a/src/popover/test/popover-template.spec.js +++ b/src/popover/test/popover-template.spec.js @@ -125,56 +125,3 @@ describe('popover template', function() { }); }); }); - -/* Deprecation tests below */ - -describe('popover template deprecation', function() { - beforeEach(module('ui.bootstrap.popover')); - beforeEach(module('template/popover/popover.html')); - beforeEach(module('template/popover/popover-template.html')); - - var elm, elmBody, elmScope, tooltipScope; - - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$popoverSuppressWarning', true); - $provide.value('$tooltipSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope, $templateCache) { - spyOn($log, 'warn'); - $templateCache.put('myUrl', [200, '{{ myTemplateText }}', {}]); - $rootScope.templateUrl = 'myUrl'; - - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - elm.trigger('click'); - tooltipScope.$digest(); - expect($log.warn.calls.count()).toBe(0); - }); - }); - - it('should give warning by default', inject(function($compile, $log, $rootScope, $templateCache) { - spyOn($log, 'warn'); - $templateCache.put('myUrl', [200, '{{ myTemplateText }}', {}]); - $rootScope.templateUrl = 'myUrl'; - - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - elm.trigger('click'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(2); - expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']); - expect($log.warn.calls.argsFor(1)).toEqual(['popover-template-popup is now deprecated. Use uib-popover-template-popup instead.']); - })); -}); diff --git a/src/popover/test/popover.spec.js b/src/popover/test/popover.spec.js index 4ba06777cb..50f4d36c1c 100644 --- a/src/popover/test/popover.spec.js +++ b/src/popover/test/popover.spec.js @@ -174,53 +174,3 @@ describe('popover', function() { }); }); }); - -/* Deprecation tests below */ - -describe('popover deprecation', function() { - beforeEach(module('ui.bootstrap.popover')); - beforeEach(module('template/popover/popover.html')); - - var elm, elmBody, elmScope, tooltipScope; - - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$popoverSuppressWarning', true); - $provide.value('$tooltipSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope) { - spyOn($log, 'warn'); - - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - elm.trigger('click'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(0); - }); - }); - - it('should give warning by default', inject(function($compile, $log, $rootScope) { - spyOn($log, 'warn'); - - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - elm.trigger('click'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(2); - expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']); - expect($log.warn.calls.argsFor(1)).toEqual(['popover-popup is now deprecated. Use uib-popover-popup instead.']); - })); -}); diff --git a/src/tooltip/test/tooltip-template.spec.js b/src/tooltip/test/tooltip-template.spec.js index ad1c97318f..c2e42c889b 100644 --- a/src/tooltip/test/tooltip-template.spec.js +++ b/src/tooltip/test/tooltip-template.spec.js @@ -82,65 +82,3 @@ describe('tooltip template', function() { expect(elmBody.children().length).toBe(1); })); }); - -/* Deprecation tests below */ - -describe('tooltip template deprecation', function() { - beforeEach(module('ui.bootstrap.tooltip')); - beforeEach(module('template/tooltip/tooltip-template-popup.html')); - - var elm, elmBody, elmScope, tooltipScope; - - function trigger(element, evt) { - evt = new Event(evt); - - element[0].dispatchEvent(evt); - element.scope().$$childTail.$digest(); - } - - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$tooltipSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope, $templateCache) { - spyOn($log, 'warn'); - $templateCache.put('myUrl', [200, '{{ myTemplateText }}', {}]); - $rootScope.templateUrl = 'myUrl'; - - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - trigger(elm, 'mouseenter'); - - expect($log.warn.calls.count()).toBe(0); - }); - }); - - it('should give warning by default', inject(function($compile, $log, $rootScope, $templateCache) { - spyOn($log, 'warn'); - $templateCache.put('myUrl', [200, '{{ myTemplateText }}', {}]); - $rootScope.templateUrl = 'myUrl'; - - var element = '
Selector Text
'; - element = $compile(element)($rootScope); - $rootScope.$digest(); - - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - trigger(elm, 'mouseenter'); - - expect($log.warn.calls.count()).toBe(2); - expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']); - expect($log.warn.calls.argsFor(1)).toEqual(['tooltip-template-popup is now deprecated. Use uib-tooltip-template-popup instead.']); - })); -}); diff --git a/src/tooltip/test/tooltip2.spec.js b/src/tooltip/test/tooltip2.spec.js index 2ed8e2b1a4..46be3bcf07 100644 --- a/src/tooltip/test/tooltip2.spec.js +++ b/src/tooltip/test/tooltip2.spec.js @@ -188,95 +188,3 @@ describe('tooltip directive', function() { expect(fragment).not.toHaveOpenTooltips(); }); }); - -/* Deprecation tests below */ - -describe('tooltip deprecation', function() { - beforeEach(module('ui.bootstrap.tooltip')); - beforeEach(module('template/tooltip/tooltip-popup.html')); - beforeEach(module('template/tooltip/tooltip-template-popup.html')); - beforeEach(module('template/tooltip/tooltip-html-popup.html')); - - describe('tooltip', function() { - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$tooltipSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope) { - spyOn($log, 'warn'); - - var element = '
Trigger here
'; - element = $compile(element)($rootScope); - $rootScope.$digest(); - expect($log.warn.calls.count()).toBe(0); - }); - }); - - it('should give warning by default', inject(function($compile, $log, $rootScope) { - spyOn($log, 'warn'); - - var element = '
Trigger here
'; - element = $compile(element)($rootScope); - $rootScope.$digest(); - - expect($log.warn.calls.count()).toBe(1); - expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']); - })); - }); - - describe('tooltip html', function() { - var elm, elmBody, elmScope, tooltipScope; - - function trigger(element, evt) { - evt = new Event(evt); - - element[0].dispatchEvent(evt); - element.scope().$$childTail.$digest(); - } - - it('should suppress warning', function() { - module(function($provide) { - $provide.value('$tooltipSuppressWarning', true); - }); - - inject(function($compile, $log, $rootScope, $sce) { - spyOn($log, 'warn'); - - $rootScope.html = 'I say: Hello!'; - $rootScope.safeHtml = $sce.trustAsHtml($rootScope.html); - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - trigger(elm, 'mouseenter'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(0); - }); - }); - - it('should give warning by default', inject(function($compile, $log, $rootScope, $sce) { - spyOn($log, 'warn'); - - $rootScope.html = 'I say: Hello!'; - $rootScope.safeHtml = $sce.trustAsHtml($rootScope.html); - elmBody = angular.element('
Selector Text
'); - $compile(elmBody)($rootScope); - $rootScope.$digest(); - elm = elmBody.find('span'); - elmScope = elm.scope(); - tooltipScope = elmScope.$$childTail; - - trigger(elm, 'mouseenter'); - tooltipScope.$digest(); - - expect($log.warn.calls.count()).toBe(2); - expect($log.warn.calls.argsFor(0)).toEqual(['$tooltip is now deprecated. Use $uibTooltip instead.']); - expect($log.warn.calls.argsFor(1)).toEqual(['tooltip-html-popup is now deprecated. Use uib-tooltip-html-popup instead.']); - })); - }); -}); diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index cbc7e97e23..7a095b243d 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -613,10 +613,7 @@ function ($animate , $sce , $compile , $templateRequest) { return { replace: true, scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/tooltip/tooltip-popup.html', - link: function(scope, element) { - element.addClass('tooltip'); - } + templateUrl: 'template/tooltip/tooltip-popup.html' }; }) @@ -629,10 +626,7 @@ function ($animate , $sce , $compile , $templateRequest) { replace: true, scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', originScope: '&' }, - templateUrl: 'template/tooltip/tooltip-template-popup.html', - link: function(scope, element) { - element.addClass('tooltip'); - } + templateUrl: 'template/tooltip/tooltip-template-popup.html' }; }) @@ -646,10 +640,7 @@ function ($animate , $sce , $compile , $templateRequest) { return { replace: true, scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/tooltip/tooltip-html-popup.html', - link: function(scope, element) { - element.addClass('tooltip'); - } + templateUrl: 'template/tooltip/tooltip-html-popup.html' }; }) @@ -658,176 +649,3 @@ function ($animate , $sce , $compile , $templateRequest) { useContentExp: true }); }]); - -/* Deprecated tooltip below */ - -angular.module('ui.bootstrap.tooltip') - -.value('$tooltipSuppressWarning', false) - -.provider('$tooltip', ['$uibTooltipProvider', function($uibTooltipProvider) { - angular.extend(this, $uibTooltipProvider); - - this.$get = ['$log', '$tooltipSuppressWarning', '$injector', function($log, $tooltipSuppressWarning, $injector) { - if (!$tooltipSuppressWarning) { - $log.warn('$tooltip is now deprecated. Use $uibTooltip instead.'); - } - - return $injector.invoke($uibTooltipProvider.$get); - }]; -}]) - -// This is mostly ngInclude code but with a custom scope -.directive('tooltipTemplateTransclude', [ - '$animate', '$sce', '$compile', '$templateRequest', '$log', '$tooltipSuppressWarning', -function ($animate , $sce , $compile , $templateRequest, $log, $tooltipSuppressWarning) { - return { - link: function(scope, elem, attrs) { - if (!$tooltipSuppressWarning) { - $log.warn('tooltip-template-transclude is now deprecated. Use uib-tooltip-template-transclude instead.'); - } - - var origScope = scope.$eval(attrs.tooltipTemplateTranscludeScope); - - var changeCounter = 0, - currentScope, - previousElement, - currentElement; - - var cleanupLastIncludeContent = function() { - if (previousElement) { - previousElement.remove(); - previousElement = null; - } - if (currentScope) { - currentScope.$destroy(); - currentScope = null; - } - if (currentElement) { - $animate.leave(currentElement).then(function() { - previousElement = null; - }); - previousElement = currentElement; - currentElement = null; - } - }; - - scope.$watch($sce.parseAsResourceUrl(attrs.tooltipTemplateTransclude), function(src) { - var thisChangeId = ++changeCounter; - - if (src) { - //set the 2nd param to true to ignore the template request error so that the inner - //contents and scope can be cleaned up. - $templateRequest(src, true).then(function(response) { - if (thisChangeId !== changeCounter) { return; } - var newScope = origScope.$new(); - var template = response; - - var clone = $compile(template)(newScope, function(clone) { - cleanupLastIncludeContent(); - $animate.enter(clone, elem); - }); - - currentScope = newScope; - currentElement = clone; - - currentScope.$emit('$includeContentLoaded', src); - }, function() { - if (thisChangeId === changeCounter) { - cleanupLastIncludeContent(); - scope.$emit('$includeContentError', src); - } - }); - scope.$emit('$includeContentRequested', src); - } else { - cleanupLastIncludeContent(); - } - }); - - scope.$on('$destroy', cleanupLastIncludeContent); - } - }; -}]) - -.directive('tooltipClasses', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) { - return { - restrict: 'A', - link: function(scope, element, attrs) { - if (!$tooltipSuppressWarning) { - $log.warn('tooltip-classes is now deprecated. Use uib-tooltip-classes instead.'); - } - - if (scope.placement) { - element.addClass(scope.placement); - } - if (scope.popupClass) { - element.addClass(scope.popupClass); - } - if (scope.animation()) { - element.addClass(attrs.tooltipAnimationClass); - } - } - }; -}]) - -.directive('tooltipPopup', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) { - return { - replace: true, - scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/tooltip/tooltip-popup.html', - link: function(scope, element) { - if (!$tooltipSuppressWarning) { - $log.warn('tooltip-popup is now deprecated. Use uib-tooltip-popup instead.'); - } - - element.addClass('tooltip'); - } - }; -}]) - -.directive('tooltip', ['$tooltip', function($tooltip) { - return $tooltip('tooltip', 'tooltip', 'mouseenter'); -}]) - -.directive('tooltipTemplatePopup', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) { - return { - replace: true, - scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', - originScope: '&' }, - templateUrl: 'template/tooltip/tooltip-template-popup.html', - link: function(scope, element) { - if (!$tooltipSuppressWarning) { - $log.warn('tooltip-template-popup is now deprecated. Use uib-tooltip-template-popup instead.'); - } - - element.addClass('tooltip'); - } - }; -}]) - -.directive('tooltipTemplate', ['$tooltip', function($tooltip) { - return $tooltip('tooltipTemplate', 'tooltip', 'mouseenter', { - useContentExp: true - }); -}]) - -.directive('tooltipHtmlPopup', ['$log', '$tooltipSuppressWarning', function($log, $tooltipSuppressWarning) { - return { - replace: true, - scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, - templateUrl: 'template/tooltip/tooltip-html-popup.html', - link: function(scope, element) { - if (!$tooltipSuppressWarning) { - $log.warn('tooltip-html-popup is now deprecated. Use uib-tooltip-html-popup instead.'); - } - - element.addClass('tooltip'); - } - }; -}]) - -.directive('tooltipHtml', ['$tooltip', function($tooltip) { - return $tooltip('tooltipHtml', 'tooltip', 'mouseenter', { - useContentExp: true - }); -}]); diff --git a/template/popover/popover-html.html b/template/popover/popover-html.html index 3751ca820f..9d33c26e27 100644 --- a/template/popover/popover-html.html +++ b/template/popover/popover-html.html @@ -1,4 +1,5 @@ -
diff --git a/template/popover/popover-template.html b/template/popover/popover-template.html index 914d1d4f2d..3d8a8ec40f 100644 --- a/template/popover/popover-template.html +++ b/template/popover/popover-template.html @@ -1,4 +1,5 @@ -
diff --git a/template/popover/popover.html b/template/popover/popover.html index 91a788388c..b31a5b4648 100644 --- a/template/popover/popover.html +++ b/template/popover/popover.html @@ -1,4 +1,5 @@ -
diff --git a/template/tooltip/tooltip-html-popup.html b/template/tooltip/tooltip-html-popup.html index dae22b7d4b..6ecef364c3 100644 --- a/template/tooltip/tooltip-html-popup.html +++ b/template/tooltip/tooltip-html-popup.html @@ -1,4 +1,4 @@ -
diff --git a/template/tooltip/tooltip-popup.html b/template/tooltip/tooltip-popup.html index 711fc561f1..dbbda48517 100644 --- a/template/tooltip/tooltip-popup.html +++ b/template/tooltip/tooltip-popup.html @@ -1,4 +1,4 @@ -
diff --git a/template/tooltip/tooltip-template-popup.html b/template/tooltip/tooltip-template-popup.html index e83bff314e..be8e97950f 100644 --- a/template/tooltip/tooltip-template-popup.html +++ b/template/tooltip/tooltip-template-popup.html @@ -1,4 +1,4 @@ -