File: webkit-border-radius-valid.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (70 lines) | stat: -rw-r--r-- 3,607 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Compatibility: parsing -webkit-border-radius with valid values</title>
<link rel="help" href="https://compat.spec.whatwg.org/#propdef--webkit-border-radius">
<link rel="help" href="https://github.com/whatwg/compat/issues/133">
<meta name="assert" content="-webkit-border-radius supports CSS Wide keywords and the full grammar '<length-percentage>{1,4} [ / <length-percentage>{1,4} ]?'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_valid_value("-webkit-border-radius", "initial");
test_valid_value("-webkit-border-radius", "inherit");
test_valid_value("-webkit-border-radius", "unset");
test_valid_value("-webkit-border-radius", "revert");

test_valid_value("-webkit-border-radius", "1px");
test_valid_value("-webkit-border-radius", "1px 5%", ["1px 5%", "1px / 5%"]);
test_valid_value("-webkit-border-radius", "1px 2% 3px");
test_valid_value("-webkit-border-radius", "1px 2% 3px 4%");
test_valid_value("-webkit-border-radius", "1px / 2px", ["1px 2px", "1px / 2px"]);
test_valid_value("-webkit-border-radius", "5em / 1px 2% 3px 4%");
test_valid_value("-webkit-border-radius", "1px 2% / 3px 4px");
test_valid_value("-webkit-border-radius", "1px 2px 3em / 1px 2px 3%");
test_valid_value("-webkit-border-radius", "1px 2% / 2px 3em 4px 5em");
test_valid_value("-webkit-border-radius", "1px 2% 3px 4% / 5em");

test_valid_value("-webkit-border-radius", "1px 1px 1px 2% / 1px 2% 1px 2%", "1px 1px 1px 2% / 1px 2%");
test_valid_value("-webkit-border-radius", "1px 1px 1px 1px / 1px 1px 2% 1px", "1px / 1px 1px 2%");
test_valid_value("-webkit-border-radius", "1px 1px 2% 2%");
test_valid_value("-webkit-border-radius", "1px 2% 1px 1px");
test_valid_value("-webkit-border-radius", "1px 2% 2% 2% / 1px 2% 3px 2%", "1px 2% 2% / 1px 2% 3px");

test_valid_value("-webkit-border-top-left-radius", "10px");
test_valid_value("-webkit-border-top-right-radius", "20%");
test_valid_value("-webkit-border-bottom-right-radius", "30px 40%");
test_valid_value("-webkit-border-bottom-left-radius", "50% 60px");

// Some browsers treat '-webkit-border-radius: l1 l2' as 'border-radius: l1 / l2'.
// Regardless of whether this is done, ensure that there is round-tripping.
const target = document.getElementById("target");
const style = target.style;
const cs = getComputedStyle(target);
test(function() {
  style.cssText = "-webkit-border-radius: 1px 2px";
  const oldLonghands = [...style].map(p => p + ": " + style[p]);
  const value = style.getPropertyValue("border-radius");
  assert_in_array(value, ["1px 2px", "1px / 2px"]);
  assert_equals(cs.getPropertyValue("border-radius"), value);
  style.cssText = "border-radius: " + value;
  const newLonghands = [...style].map(p => p + ": " + style[p]);
  assert_array_equals(newLonghands, oldLonghands);
}, "Serialize border-radius from -webkit-border-radius: 1px 2px");
test(function() {
  style.cssText = "border-radius: 1px 2px";
  const oldLonghands = [...style].map(p => p + ": " + style[p]);
  const value = style.getPropertyValue("-webkit-border-radius");
  assert_in_array(value, ["1px 2px", "1px 2px 1px"]);
  assert_equals(cs.getPropertyValue("-webkit-border-radius"), value);
  style.cssText = "-webkit-border-radius: " + value;
  const newLonghands = [...style].map(p => p + ": " + style[p]);
  assert_array_equals(newLonghands, oldLonghands);
}, "Serialize -webkit-border-radius from border-radius: 1px 2px");
</script>
</body>
</html>