mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
Automatic update from web-platform-testsSVG Geometry: computed value of properties (#14075) cx cy r rx ry x y computed values are lengths or percentages. https://svgwg.org/svg2-draft/geometry.html -- wpt-commits: 39c2331ea623e23849d2f6fc99f804e5e2d374d2 wpt-pr: 14075
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Create test that a CSS property computes to the expected value.
|
|
* The document element #target is used to perform the test.
|
|
*
|
|
* @param {string} property The name of the CSS property being tested.
|
|
* @param {string} specified A specified value for the property.
|
|
* @param {string} computed The expected computed value. If omitted,
|
|
defaults to specified.
|
|
*/
|
|
function test_computed_value(property, specified, computed) {
|
|
if (!computed)
|
|
computed = specified;
|
|
test(() => {
|
|
const target = document.getElementById('target');
|
|
if (!getComputedStyle(target)[property])
|
|
return;
|
|
target.style[property] = '';
|
|
target.style[property] = specified;
|
|
assert_equals(getComputedStyle(target)[property], computed);
|
|
if (computed !== specified) {
|
|
target.style[property] = '';
|
|
target.style[property] = computed;
|
|
assert_equals(getComputedStyle(target)[property], computed, 'computed value should round-trip');
|
|
}
|
|
}, "Property " + property + " value '" + specified + "' computes to '" + computed + "'");
|
|
}
|