Log document.body in JS tests

This commit is contained in:
Florian Bruhin 2018-03-20 11:56:46 +01:00
parent 85d3d4baba
commit a5f1022330
2 changed files with 8 additions and 6 deletions

View File

@ -46,10 +46,10 @@ class JSTester:
self.qtbot = qtbot
loader = jinja2.FileSystemLoader(os.path.dirname(__file__))
self._jinja_env = jinja2.Environment(loader=loader, autoescape=True)
# Make sure logging via JS fails tests
# Make sure error logging via JS fails tests
config_stub.val.content.javascript.log = {
'info': 'info',
'error': 'error',
'info': 'error',
'unknown': 'error',
'warning': 'error'
}

View File

@ -60,10 +60,12 @@ class StylesheetTester:
def check_set(self, value, css_style="background-color",
document_element="document.body"):
"""Check whether the css in ELEMENT is set to VALUE."""
self.js.run("window.getComputedStyle({}, null)"
".getPropertyValue('{}');"
.format(document_element,
javascript.string_escape(css_style)), value)
self.js.run("console.log({document});"
"window.getComputedStyle({document}, null)"
".getPropertyValue('{prop}');".format(
document=document_element,
prop=javascript.string_escape(css_style)),
value)
def check_eq(self, one, two, true=True):
"""Check if one and two are equal."""