From 3468888ae29189c5d1040fbb0855203ea515c746 Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Thu, 14 Jan 2016 05:18:53 -0800 Subject: [PATCH] test(tooltip): add test for class change - Add test for adding the appropriate classes to the tooltip Closes #5244 --- src/tooltip/test/tooltip.spec.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/tooltip/test/tooltip.spec.js b/src/tooltip/test/tooltip.spec.js index b04989ec1e..11d570996d 100644 --- a/src/tooltip/test/tooltip.spec.js +++ b/src/tooltip/test/tooltip.spec.js @@ -1128,4 +1128,35 @@ describe('$uibTooltipProvider', function() { })); }); }); + + describe('placementClassPrefix', function() { + beforeEach(module('ui.bootstrap.tooltip', function($uibTooltipProvider) { + $uibTooltipProvider.options({placementClassPrefix: 'uib-'}); + })); + + // load the template + beforeEach(module('uib/template/tooltip/tooltip-popup.html')); + + it('should add the classes', inject(function($rootScope, $compile, $timeout) { + elmBody = angular.element( + '
' + ); + + scope = $rootScope; + $compile(elmBody)(scope); + scope.$digest(); + elm = elmBody.find('span'); + elmScope = elm.scope(); + tooltipScope = elmScope.$$childTail; + + expect(elmBody.children().length).toBe(1); + + trigger(elm, 'mouseenter'); + $timeout.flush(); + + var tooltipElm = elmBody.find('.tooltip'); + expect(tooltipElm.hasClass('top')).toBe(true); + expect(tooltipElm.hasClass('uib-top-right')).toBe(true); + })); + }); });