remix-project mirror
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.
remix-project/apps/remix-ide/test-browser/commands/scrollInto.js

24 lines
498 B

const EventEmitter = require('events')
class ScrollInto extends EventEmitter {
command (target) {
this.api.perform((client, done) => {
_scrollInto(this.api, target, () => {
done()
this.emit('complete')
})
})
return this
}
}
function _scrollInto (browser, target, cb) {
browser.execute(function (target) {
document.querySelector(target).scrollIntoView(({block: 'center'}))
}, [target], function () {
cb()
})
}
module.exports = ScrollInto