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

Commit

Permalink
test(tooltip): add test for class change
Browse files Browse the repository at this point in the history
- Add test for adding the appropriate classes to the tooltip

Closes #5244
  • Loading branch information
wesleycho committed Jan 14, 2016
1 parent 6a2d91b commit 3468888
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/tooltip/test/tooltip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'<div><span uib-tooltip="tooltip text" tooltip-placement="top-right"></span></div>'
);

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);
}));
});
});

0 comments on commit 3468888

Please sign in to comment.