Index: test/browser/elemHideEmulation.js |
=================================================================== |
--- a/test/browser/elemHideEmulation.js |
+++ b/test/browser/elemHideEmulation.js |
@@ -50,26 +50,32 @@ |
} |
function unexpectedError(error) |
{ |
console.error(error); |
this.ok(false, "Unexpected error: " + error); |
} |
-function expectHidden(test, element) |
+function expectHidden(test, element, id) |
{ |
- test.equal(window.getComputedStyle(element).display, "none", |
- "The element's display property should be set to 'none'"); |
+ let message = id ? |
kzar
2018/03/21 18:11:59
This seems kind of messy, also I guess the ID migh
hub
2018/03/21 19:05:04
Done.
hub
2018/03/21 19:05:04
Hence my original approach, since these are just t
kzar
2018/03/22 09:40:04
Sorry I was talking nonsense here, the ID is a str
kzar
2018/03/22 09:40:04
Yea fair enough.
|
+ `The element with ID '${id}' display property should be set to 'none'` : |
+ "The element's display property should be set to 'none'"; |
+ test.equal( |
+ window.getComputedStyle(element).display, "none", message); |
} |
-function expectVisible(test, element) |
+function expectVisible(test, element, id) |
{ |
- test.notEqual(window.getComputedStyle(element).display, "none", |
- "The element's display property should not be set to 'none'"); |
+ let message = id ? |
+ `The element with ID '${id}' display property should not be set to 'none'` : |
+ "The element's display property should not be set to 'none'"; |
+ test.notEqual( |
+ window.getComputedStyle(element).display, "none", message); |
} |
function findUniqueId() |
{ |
let id = "elemHideEmulationTest-" + Math.floor(Math.random() * 10000); |
if (!testDocument.getElementById(id)) |
return id; |
return findUniqueId(); |
@@ -355,19 +361,19 @@ |
function compareExpectations(test, elems, expectations) |
{ |
for (let elem in expectations) |
{ |
if (elems[elem]) |
{ |
if (expectations[elem]) |
- expectVisible(test, elems[elem]); |
+ expectVisible(test, elems[elem], elem); |
else |
- expectHidden(test, elems[elem]); |
+ expectHidden(test, elems[elem], elem); |
} |
} |
} |
function runTestPseudoClassHasSelectorWithHasAndWithSuffixSibling(test, selector, expectations) |
{ |
testDocument.body.innerHTML = `<div id="parent"> |
<div id="middle"> |