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

Commit 3468888

Browse files
committed
test(tooltip): add test for class change
- Add test for adding the appropriate classes to the tooltip Closes #5244
1 parent 6a2d91b commit 3468888

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

+31
Original file line numberDiff line numberDiff line change
@@ -1128,4 +1128,35 @@ describe('$uibTooltipProvider', function() {
11281128
}));
11291129
});
11301130
});
1131+
1132+
describe('placementClassPrefix', function() {
1133+
beforeEach(module('ui.bootstrap.tooltip', function($uibTooltipProvider) {
1134+
$uibTooltipProvider.options({placementClassPrefix: 'uib-'});
1135+
}));
1136+
1137+
// load the template
1138+
beforeEach(module('uib/template/tooltip/tooltip-popup.html'));
1139+
1140+
it('should add the classes', inject(function($rootScope, $compile, $timeout) {
1141+
elmBody = angular.element(
1142+
'<div><span uib-tooltip="tooltip text" tooltip-placement="top-right"></span></div>'
1143+
);
1144+
1145+
scope = $rootScope;
1146+
$compile(elmBody)(scope);
1147+
scope.$digest();
1148+
elm = elmBody.find('span');
1149+
elmScope = elm.scope();
1150+
tooltipScope = elmScope.$$childTail;
1151+
1152+
expect(elmBody.children().length).toBe(1);
1153+
1154+
trigger(elm, 'mouseenter');
1155+
$timeout.flush();
1156+
1157+
var tooltipElm = elmBody.find('.tooltip');
1158+
expect(tooltipElm.hasClass('top')).toBe(true);
1159+
expect(tooltipElm.hasClass('uib-top-right')).toBe(true);
1160+
}));
1161+
});
11311162
});

0 commit comments

Comments
 (0)