Skip to content

Commit aa30faf

Browse files
committed
fix(ionTab): stop browser-tooltip from appearing due to title attr
Closes #804
1 parent 95b6a83 commit aa30faf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

js/ext/angular/src/directive/ionicTabBar.js

+3
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,9 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService) {
365365
var tabsCtrl = ctrls[0],
366366
tabCtrl = ctrls[1];
367367

368+
//Remove title attribute so browser-tooltip does not apear
369+
$element[0].removeAttribute('title');
370+
368371
$scope.selectTab = function(e) {
369372
e.preventDefault();
370373
tabsCtrl.select(tabCtrl.$scope, true);

js/ext/angular/test/directive/ionicTabBar.unit.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ describe('tabs', function() {
294294
it('should compile a <ion-tab-nav> with all of the relevant attrs', function() {
295295
setup('title=1 icon-on=2 icon-off=3 badge=4 badge-style=5 ng-click=6');
296296
var navItem = angular.element(tabsEl[0].querySelector('.tab-item'));
297-
expect(navItem.attr('title')).toEqual('1');
297+
//Use .scope for title because we remove title attr
298+
//(for dom-tooltip not to appear)
299+
expect(navItem.scope().title).toEqual('1');
298300
expect(navItem.attr('icon-on')).toEqual('2');
299301
expect(navItem.attr('icon-off')).toEqual('3');
300302
expect(navItem.attr('badge')).toEqual('4');
@@ -401,6 +403,12 @@ describe('tabs', function() {
401403
return element;
402404
}
403405

406+
it('should remove title attribute', function() {
407+
var el = setup('title="something"');
408+
expect(el[0].hasAttribute('title')).toBe(false);
409+
expect(el.isolateScope().title).toBe('something');
410+
});
411+
404412
// These next two are REALLY specific unit tests,
405413
// but also are really really vital pieces of code
406414
it('.isTabActive should be correct', function() {

0 commit comments

Comments
 (0)