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
533 B

exports.assertion = function (selector, expected) {
this.message = 'Testing if element <' + selector + '> is focused.'
this.expected = expected !== false
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) {
return document.querySelector(selector) === document.activeElement
}, [selector], function (res) {
cb.call(self, res)
})
}
}