Allow elements to be passed to toContain matcher

This commit is contained in:
Nathan Sobo 2015-09-09 18:03:13 -07:00
parent 2ef6d1be96
commit d528765161

View File

@ -154,11 +154,15 @@ var jQueryMatchers = {
}
},
toContain: function(selector) {
toContain: function(contained) {
if (this.actual instanceof HTMLElement) {
return !!this.actual.querySelector(selector)
if (typeof contained === 'string') {
return this.actual.querySelector(contained)
} else {
return this.actual.find(selector).size() > 0
return this.actual.contains(contained)
}
} else {
return this.actual.find(contained).size() > 0
}
},