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/checkElementStyle.js

26 lines
816 B

const EventEmitter = require('events')
class checkElementStyle extends EventEmitter {
command (cssSelector, styleProperty, expectedResult) {
this.api.perform((done) => {
checkStyle(this.api, cssSelector, styleProperty, expectedResult, () => {
done()
this.emit('complete')
})
})
return this
}
}
function checkStyle (browser, cssSelector, styleProperty, expectedResult, callback) {
browser.execute(function (cssSelector, styleProperty) {
return window.getComputedStyle(document.querySelector(cssSelector)).getPropertyValue(styleProperty)
}, [cssSelector, styleProperty], function (result) {
const value = result.value
browser.assert.equal(value.trim().toLowerCase(), expectedResult.toLowerCase())
callback()
})
}
module.exports = checkElementStyle