Use a hacked click element to make it work in PhantomJS
This commit is contained in:
parent
c6989e735b
commit
58b663e19b
1 changed files with 15 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Reference in a new issue