diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js
index f84d6dc704..25bf14cb04 100644
--- a/js/ext/angular/src/directive/ionicTabBar.js
+++ b/js/ext/angular/src/directive/ionicTabBar.js
@@ -1,4 +1,4 @@
-angular.module('ionic.ui.tabs', ['ionic.service.view'])
+angular.module('ionic.ui.tabs', ['ionic.service.view', 'ionic.ui.bindHtml'])
/**
* @description
@@ -93,7 +93,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view'])
$scope.tabsController = this;
}],
-
+
template: '
' +
- '
' +
+ template: '
' +
+ '' +
'
',
link: function($scope, $element, $attr, tabsCtrl) {
$element.addClass($scope.tabsType);
@@ -274,17 +274,18 @@ angular.module('ionic.ui.tabs', ['ionic.service.view'])
if(attrs.icon) {
scope.iconOn = scope.iconOff = attrs.icon;
}
-
+
scope.selectTab = function() {
tabsCtrl.select(scope.index, true);
};
},
- template:
+ template:
'
' +
'{{badge}}' +
'' +
'' +
- ' {{iconTitle}}' +
+ '' +
+ '' +
''
};
}]);
diff --git a/js/ext/angular/test/directive/ionicTabBar.unit.js b/js/ext/angular/test/directive/ionicTabBar.unit.js
index 716f72d052..1bdb4d35ba 100644
--- a/js/ext/angular/test/directive/ionicTabBar.unit.js
+++ b/js/ext/angular/test/directive/ionicTabBar.unit.js
@@ -2,7 +2,7 @@ describe('Tab Bar Controller', function() {
var compile, element, scope, ctrl;
beforeEach(module('ionic.ui.tabs'));
-
+
beforeEach(inject(function($compile, $rootScope, $controller) {
compile = $compile;
scope = $rootScope;
@@ -63,20 +63,20 @@ describe('Tab Bar Controller', function() {
describe('Tabs directive', function() {
var compile, element, scope;
-
+
beforeEach(module('ionic.ui.tabs'));
beforeEach(inject(function($compile, $rootScope) {
compile = $compile;
scope = $rootScope;
}));
-
+
it('Has tab class', function() {
element = compile('
')(scope);
scope.$digest();
expect(element.find('.tabs').hasClass('tabs')).toBe(true);
});
-
+
it('Has tab children', function() {
element = compile('
')(scope);
scope = element.scope();
@@ -90,18 +90,18 @@ describe('Tabs directive', function() {
});
it('Has compiled children', function() {
- element = compile('
' +
- '' +
- '' +
+ element = compile('' +
+ '' +
+ '' +
'')(scope);
scope.$digest();
expect(element.find('a').length).toBe(2);
});
it('Sets style on child tabs', function() {
- element = compile('' +
- '' +
- '' +
+ element = compile('' +
+ '' +
+ '' +
'')(scope);
scope.$digest();
var tabs = element[0].querySelector('.tabs');
@@ -110,9 +110,9 @@ describe('Tabs directive', function() {
});
it('Has nav-view', function() {
- element = compile('' +
- '' +
- 'content2' +
+ element = compile('' +
+ '' +
+ 'content2' +
'')(scope);
scope = element.scope();
scope.$digest();
@@ -129,7 +129,7 @@ describe('Tabs directive', function() {
describe('Tab Item directive', function() {
var compile, element, scope, ctrl;
-
+
beforeEach(module('ionic.ui.tabs'));
beforeEach(inject(function($compile, $rootScope, $document, $controller) {
@@ -138,23 +138,16 @@ describe('Tab Item directive', function() {
scope.badgeValue = 3;
element = compile('' +
- '' +
+ '' +
'')(scope);
scope.$digest();
$document[0].body.appendChild(element[0]);
}));
-
- it('Default text works', function() {
- var title = '';
- var a = element.find('a')[0];
- for(i = 0, j = a.childNodes.length; i < j; i++) {
- child = a.childNodes[i];
- if (child.nodeName === "#text") {
- title += child.nodeValue.trim();
- }
- }
- expect(title).toEqual('Item');
+ it('Title works', function() {
+ //The badge's text gets in the way of just doing .text() on the element itself, so exclude it
+ var notBadge = angular.element(element[0].querySelectorAll('a >:not(.badge)'));
+ expect(notBadge.text().trim()).toEqual('Item');
});
it('Default icon works', function() {
@@ -189,7 +182,7 @@ describe('Tab Item directive', function() {
describe('Tab Controller Item directive', function() {
var compile, element, scope, ctrl;
-
+
beforeEach(module('ionic.ui.tabs'));
beforeEach(inject(function($compile, $rootScope, $document, $controller) {
@@ -198,24 +191,15 @@ describe('Tab Controller Item directive', function() {
scope.badgeValue = 3;
scope.isActive = false;
- element = compile('' +
- '' +
+ element = compile('' +
+ '' +
'')(scope);
scope.$digest();
$document[0].body.appendChild(element[0]);
}));
-
- it('Icon title works', function() {
- var title = '';
- var a = element.find('a')[0];
- for(var i = 0, j = a.childNodes.length; i < j; i++) {
- child = a.childNodes[i];
- if (child.nodeName === "#text") {
- title += child.nodeValue.trim();
- }
- }
- expect(title).toEqual('Icon title');
+ it('Icon title works as html', function() {
+ expect(element.find('a').find('span').html()).toEqual('Icon title');
});
it('Icon classes works', function() {
diff --git a/js/ext/angular/test/tabs.html b/js/ext/angular/test/tabs.html
index e2f2a695e8..37c1b94446 100644
--- a/js/ext/angular/test/tabs.html
+++ b/js/ext/angular/test/tabs.html
@@ -58,7 +58,7 @@
tabs-style="tabs-top tabs-positive"
controller-changed="onControllerChanged(oldController, oldIndex, newController, newIndex)">
-
+