diff --git a/static/js/app.js b/static/js/app.js index 90eb85de3..30cb7a6b3 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -12,6 +12,18 @@ function getRestUrl(args) { return url; } +function clickElement(el){ + // From: http://stackoverflow.com/questions/16802795/click-not-working-in-mocha-phantomjs-on-certain-elements + var ev = document.createEvent("MouseEvent"); + ev.initMouseEvent( + "click", + true /* bubble */, true /* cancelable */, + window, null, + 0, 0, 0, 0, /* coordinates */ + false, false, false, false, /* modifier keys */ + 0 /*left*/, null); + el.dispatchEvent(ev); +} function getFirstTextLine(commentString) { if (!commentString) { return ''; } @@ -2244,9 +2256,7 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi return; } - if (this.click) { - this.click(); - } + clickElement(this); }); }, opt_timeout); }; @@ -2254,8 +2264,8 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi var resetDefaultTab = function() { $timeout(function() { $('a[data-toggle="tab"]').each(function(index) { - if (index == 0 && this.click) { - this.click(); + if (index == 0) { + clickElement(this); } }); });