mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Fixed one small test
This commit is contained in:
@ -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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user