You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
535 B
18 lines
535 B
exports.assertion = function (selector, attr) {
|
|
this.message = 'Testing if element <' + selector + '> has attribute ' + attr + '.'
|
|
this.expected = true
|
|
this.value = function (res) {
|
|
return res.value
|
|
}
|
|
this.pass = function (val) {
|
|
return val === this.expected
|
|
}
|
|
this.command = function (cb) {
|
|
var self = this
|
|
return this.api.execute(function (selector, attr) {
|
|
return document.querySelector(selector).hasAttribute(attr)
|
|
}, [selector, attr], function (res) {
|
|
cb.call(self, res)
|
|
})
|
|
}
|
|
}
|
|
|