hasHTML.js 505 B

123456789101112131415161718
  1. exports.assertion = function (selector, html) {
  2. this.message = 'Testing if element <' + selector + '> has HTML: ' + html
  3. this.expected = html
  4. this.value = function (res) {
  5. return res.value
  6. }
  7. this.pass = function (val) {
  8. return val.indexOf(html) > -1
  9. }
  10. this.command = function (cb) {
  11. var self = this
  12. return this.api.execute(function (selector) {
  13. return document.querySelector(selector).innerHTML
  14. }, [selector], function (res) {
  15. cb.call(self, res)
  16. })
  17. }
  18. }