Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/browser/elemHideEmulation.js

Issue 29721681: Noissue - Allow identifying the element in case of error in test (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 13, 2018, 2:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browser/elemHideEmulation.js
===================================================================
--- a/test/browser/elemHideEmulation.js
+++ b/test/browser/elemHideEmulation.js
@@ -50,26 +50,30 @@
}
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 elementId = id ? `: ${id}` : "";
+ test.equal(
+ window.getComputedStyle(element).display, "none",
+ `The element's display property should be set to 'none' ${elementId}`);
kzar 2018/03/19 16:55:20 Please can you improve the message, like "The elem
hub 2018/03/20 14:40:26 Done.
}
-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 elementId = id ? `: ${id}` : "";
+ test.notEqual(
+ window.getComputedStyle(element).display, "none",
+ `The element's display property should not be set to 'none' ${elementId}`);
}
function findUniqueId()
{
let id = "elemHideEmulationTest-" + Math.floor(Math.random() * 10000);
if (!testDocument.getElementById(id))
return id;
return findUniqueId();
@@ -355,19 +359,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">
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld