Skip to content

Commit

Permalink
Allow elements to be passed to toContain matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Sobo committed Sep 19, 2015
1 parent 2ef6d1b commit d528765
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vendor/jasmine-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.contains(contained)
}
} else {
return this.actual.find(selector).size() > 0
return this.actual.find(contained).size() > 0
}
},

Expand Down

0 comments on commit d528765

Please sign in to comment.