Fixed one small test

This commit is contained in:
Max Lynch
2013-09-13 17:11:47 -05:00
parent 3fd6b41636
commit 497084cd41
2 changed files with 5 additions and 7 deletions

View File

@ -31,7 +31,8 @@ TabBarItem.prototype = {
ionic.on('tap', this._tapHandler, this.el); ionic.on('tap', this._tapHandler, this.el);
}, },
onTap: function() { onTap: function(e) {
console.log('On tap');
}, },
// Remove the event listeners from this object // Remove the event listeners from this object
@ -92,7 +93,6 @@ TabBar.prototype = {
if(!this._itemTapHandler) { if(!this._itemTapHandler) {
this._itemTapHandler = function(e) { this._itemTapHandler = function(e) {
console.log('TAB HANDERL', e, this);
_this.selectItem(this); _this.selectItem(this);
}; };
} }

View File

@ -51,18 +51,16 @@ describe('TabBar view', function() {
it('Should handle item click event', function() { it('Should handle item click event', function() {
debugger;
var item = items[0]; var item = items[0];
spyOn(item, 'onTap'); spyOn(tabBar, 'selectItem');
spyOn(tabBar, '_itemTapHandler');
var event = new CustomEvent('tap', { var event = new CustomEvent('tap', {
target: item.el target: item.el
}); });
item.el.dispatchEvent(event); item.el.dispatchEvent(event);
expect(item.onTap).toHaveBeenCalled(); //expect(item.onTap).toHaveBeenCalled();
expect(tabBar._itemTapHandler).toHaveBeenCalled(); expect(tabBar.selectItem).toHaveBeenCalled();
}); });