0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

CasperJS waitForOpaque fails more gracefully

This commit is contained in:
Hannah Wolfe 2013-12-15 18:15:52 +00:00
parent 1c52e3a980
commit 96f246533b

View file

@ -58,10 +58,17 @@ casper.writeContentToCodeMirror = function (content) {
casper.waitForOpaque = function (classname, then, timeout) {
casper.waitFor(function checkOpaque() {
return this.evaluate(function (element) {
var value = this.evaluate(function (element) {
var target = document.querySelector(element);
if (target === null) {
return null;
}
return window.getComputedStyle(target).getPropertyValue('opacity') === "1";
}, classname);
if (value !== true && value !== false) {
casper.test.fail('Unable to find element: ' + classname);
}
return value;
}, then, timeout);
};