Created
September 30, 2015 20:45
-
-
Save beatfactor/8b49e28947c6a048bc4f to your computer and use it in GitHub Desktop.
elementEmpty.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.assertion = function(selector) { | |
this.selector = selector; | |
this.message = 'Testing if element <' + selector + '> has no descendents.'; | |
this.expected = true; | |
this.pass = function(value) { | |
return value && (value.length === 0); | |
}; | |
this.value = function(result) { | |
return result && result.value; | |
}; | |
this.command = function(callback) { | |
var self = this; | |
this.api.elements('css selector', this.selector, function(result) { | |
if (result.status === 0 && result.value.length > 0) { | |
this.elementIdElements(result.value[0].ELEMENT, 'css selector', '*', function(res) { | |
callback(res); | |
}); | |
} else { | |
self.message += ' No elements were returned for selector: ' + self.selector; | |
callback(false); | |
} | |
}); | |
return this; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment