fix(ionTab): stop browser-tooltip from appearing due to title attr

Closes #804
This commit is contained in:
Andy Joslin
2014-03-15 18:57:10 -06:00
parent 95b6a83dad
commit aa30faf863
2 changed files with 12 additions and 1 deletions

View File

@@ -365,6 +365,9 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService) {
var tabsCtrl = ctrls[0],
tabCtrl = ctrls[1];
//Remove title attribute so browser-tooltip does not apear
$element[0].removeAttribute('title');
$scope.selectTab = function(e) {
e.preventDefault();
tabsCtrl.select(tabCtrl.$scope, true);

View File

@@ -294,7 +294,9 @@ describe('tabs', function() {
it('should compile a <ion-tab-nav> with all of the relevant attrs', function() {
setup('title=1 icon-on=2 icon-off=3 badge=4 badge-style=5 ng-click=6');
var navItem = angular.element(tabsEl[0].querySelector('.tab-item'));
expect(navItem.attr('title')).toEqual('1');
//Use .scope for title because we remove title attr
//(for dom-tooltip not to appear)
expect(navItem.scope().title).toEqual('1');
expect(navItem.attr('icon-on')).toEqual('2');
expect(navItem.attr('icon-off')).toEqual('3');
expect(navItem.attr('badge')).toEqual('4');
@@ -401,6 +403,12 @@ describe('tabs', function() {
return element;
}
it('should remove title attribute', function() {
var el = setup('title="something"');
expect(el[0].hasAttribute('title')).toBe(false);
expect(el.isolateScope().title).toBe('something');
});
// These next two are REALLY specific unit tests,
// but also are really really vital pieces of code
it('.isTabActive should be correct', function() {