diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-06-26 10:48:30 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-06-26 10:48:30 +0200 |
commit | 1359e8e4624d10ceb0bf55bcb1cb2903141c6d38 (patch) | |
tree | 131f289fd18efb5b28653f6b5d83953f8e6c820b /tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js | |
parent | f017169ae482effc446384050e79b752bd9ddfe5 (diff) | |
download | servo-1359e8e4624d10ceb0bf55bcb1cb2903141c6d38.tar.gz servo-1359e8e4624d10ceb0bf55bcb1cb2903141c6d38.zip |
Move `tests/wpt/web-platform-tests` to `tests/wpt/tests`
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.js | 96 |
1 files changed, 0 insertions, 96 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 deleted file mode 100644 index 38ac94eb12e..00000000000 --- a/tests/wpt/web-platform-tests/css/support/inheritance-testcommon.js +++ /dev/null @@ -1,96 +0,0 @@ -'use strict'; - -(function() { - -function assert_initial(property, initial) { - let initialDesc = initial; - if (Array.isArray(initial)) - initialDesc = '[' + initial.map(e => "'" + e + "'").join(' or ') + ']'; - - test(() => { - const target = document.getElementById('target'); - assert_true(property in getComputedStyle(target), property + " doesn't seem to be supported in the computed style"); - target.style[property] = 'initial'; - if (Array.isArray(initial)) { - assert_in_array(getComputedStyle(target)[property], initial); - } else { - assert_equals(getComputedStyle(target)[property], initial); - } - target.style[property] = ''; - }, 'Property ' + property + ' has initial value ' + initialDesc); -} - -/** - * 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|array} initial The computed value for 'initial' or a list - * of acceptable computed value serializations. - * @param {string} other An arbitrary value for the property that - * round trips and is distinct from the initial - * value. - */ -function assert_inherited(property, initial, other) { - if (initial) - assert_initial(property, initial); - - test(() => { - const container = document.getElementById('container'); - const target = document.getElementById('target'); - assert_true(property in getComputedStyle(target), property + " doesn't seem to be supported in the computed style"); - container.style[property] = 'initial'; - target.style[property] = 'unset'; - assert_not_equals(getComputedStyle(container)[property], other); - assert_not_equals(getComputedStyle(target)[property], other); - container.style[property] = other; - assert_equals(getComputedStyle(container)[property], other); - assert_equals(getComputedStyle(target)[property], other); - target.style[property] = 'initial'; - assert_equals(getComputedStyle(container)[property], other); - assert_not_equals(getComputedStyle(target)[property], other); - target.style[property] = 'inherit'; - assert_equals(getComputedStyle(target)[property], other); - container.style[property] = ''; - target.style[property] = ''; - }, 'Property ' + property + ' inherits'); -} - -/** - * 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|array} initial The computed value for 'initial' or a list - * of acceptable computed value serializations. - * @param {string} other An arbitrary value for the property that - * round trips and is distinct from the initial - * value. - */ -function assert_not_inherited(property, initial, other) { - assert_initial(property, initial); - - test(() => { - const container = document.getElementById('container'); - const target = document.getElementById('target'); - assert_true(property in getComputedStyle(target)); - container.style[property] = 'initial'; - target.style[property] = 'unset'; - assert_not_equals(getComputedStyle(container)[property], other); - assert_not_equals(getComputedStyle(target)[property], other); - container.style[property] = other; - assert_equals(getComputedStyle(container)[property], other); - assert_not_equals(getComputedStyle(target)[property], other); - target.style[property] = 'inherit'; - assert_equals(getComputedStyle(target)[property], other); - container.style[property] = ''; - target.style[property] = ''; - }, 'Property ' + property + ' does not inherit'); -} - -window.assert_inherited = assert_inherited; -window.assert_not_inherited = assert_not_inherited; -})(); |