aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js')
-rw-r--r--tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js b/tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js
index 9f59cbbb6de..9229f1268ea 100644
--- a/tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js
+++ b/tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js
@@ -1,7 +1,10 @@
'use strict';
+(function() {
+
function assert_initial(property, initial) {
test(() => {
+ const target = document.getElementById('target');
if (!getComputedStyle(target)[property])
return;
target.style[property] = 'initial';
@@ -13,6 +16,8 @@ function assert_initial(property, initial) {
/**
* Create tests that a CSS property inherits and has the given initial value.
*
+ * The current document must have an element #target within element #container.
+ *
* @param {string} property The name of the CSS property being tested.
* @param {string} initial The computed value for 'initial'.
* @param {string} other An arbitrary value for the property that round
@@ -22,6 +27,8 @@ function assert_inherited(property, initial, other) {
assert_initial(property, initial);
test(() => {
+ const container = document.getElementById('container');
+ const target = document.getElementById('target');
if (!getComputedStyle(target)[property])
return;
container.style[property] = 'initial';
@@ -45,6 +52,8 @@ function assert_inherited(property, initial, other) {
* Create tests that a CSS property does not inherit, and that it has the
* given initial value.
*
+ * The current document must have an element #target within element #container.
+ *
* @param {string} property The name of the CSS property being tested.
* @param {string} initial The computed value for 'initial'.
* @param {string} other An arbitrary value for the property that round
@@ -54,6 +63,8 @@ function assert_not_inherited(property, initial, other) {
assert_initial(property, initial);
test(() => {
+ const container = document.getElementById('container');
+ const target = document.getElementById('target');
if (!getComputedStyle(target)[property])
return;
container.style[property] = 'initial';
@@ -69,3 +80,7 @@ function assert_not_inherited(property, initial, other) {
target.style[property] = '';
}, 'Property ' + property + ' does not inherit');
}
+
+window.assert_inherited = assert_inherited;
+window.assert_not_inherited = assert_not_inherited;
+})();