activator: do not activate if tapRequiresNativeClick

Addresses #1202
This commit is contained in:
Andy Joslin
2014-04-25 06:25:52 -06:00
parent 90da2da66f
commit 8e3a3d0b2d
2 changed files with 9 additions and 0 deletions

View File

@@ -9,9 +9,11 @@
ionic.activator = {
start: function(e) {
// when an element is touched/clicked, it climbs up a few
// parents to see if it is an .item or .button element
ionic.requestAnimationFrame(function(){
if (tapRequiresNativeClick(e.target)) return;
var ele = e.target;
var eleToActivate;

View File

@@ -4,6 +4,13 @@ describe('Ionic Element Activator', function() {
window.setTimeout = ionic.requestAnimationFrame = function(cb) { cb(); };
});
it('should not active an <a> if tapRequiresNativeClick is true', function() {
spyOn(window, 'tapRequiresNativeClick').andReturn(true);
var e = { target: document.createElement('a') };
ionic.activator.start(e);
expect(e.target.classList.contains('activated')).toEqual(false);
});
it('Should activate an <a>', function() {
var e = { target: document.createElement('a') };
ionic.activator.start(e);