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;
|
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) {
|
function getFirstTextLine(commentString) {
|
||||||
if (!commentString) { return ''; }
|
if (!commentString) { return ''; }
|
||||||
|
@ -2244,9 +2256,7 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.click) {
|
clickElement(this);
|
||||||
this.click();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, opt_timeout);
|
}, opt_timeout);
|
||||||
};
|
};
|
||||||
|
@ -2254,8 +2264,8 @@ quayApp.run(['$location', '$rootScope', 'Restangular', 'UserService', 'PlanServi
|
||||||
var resetDefaultTab = function() {
|
var resetDefaultTab = function() {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$('a[data-toggle="tab"]').each(function(index) {
|
$('a[data-toggle="tab"]').each(function(index) {
|
||||||
if (index == 0 && this.click) {
|
if (index == 0) {
|
||||||
this.click();
|
clickElement(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue