lib/jspec.jquery.js in visionmedia-jspec-2.7.2 vs lib/jspec.jquery.js in visionmedia-jspec-2.8.1
- old
+ new
@@ -30,13 +30,21 @@
have_many : "alias have_tags",
have_child : "jQuery(actual).children(expected).length == 1",
have_children : "jQuery(actual).children(expected).length > 1",
have_text : "jQuery(actual).text() == expected",
have_value : "jQuery(actual).val() == expected",
- be_visible : "!jQuery(actual).is(':hidden')",
- be_hidden : "jQuery(actual).is(':hidden')",
be_enabled : "!jQuery(actual).attr('disabled')",
have_class : "jQuery(actual).hasClass(expected)",
+
+ be_visible : function(actual) {
+ return jQuery(actual).css('display') != 'none' &&
+ jQuery(actual).css('visibility') != 'hidden' &&
+ jQuery(actual).attr('type') != 'hidden'
+ },
+
+ be_hidden : function(actual) {
+ return !JSpec.does(actual, 'be_visible')
+ },
have_classes : function(actual) {
return !JSpec.any(JSpec.argumentsToArray(arguments, 1), function(arg){
return !JSpec.does(actual, 'have_class', arg)
})