summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-backgrounds/inheritance.sub.html
blob: 01bb8422991ee48da525087d5462c380c5eb8b84 (plain)
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
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inheritance of CSS Backgrounds and Borders properties</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#property-index">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-4/#property-index">
<meta name="assert" content="Properties inherit or not according to the spec.">
<meta name="assert" content="Properties have initial values according to the spec.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/inheritance-testcommon.js"></script>
</head>
<body>
<div id="reference"></div>
<!-- container and target are used by the functions in inheritance-testcommon.js -->
<div id="container">
  <div id="target"></div>
</div>
<style>
  #reference {
    column-rule-style: dotted; /* Avoid column-rule-width computed style 0px */
    column-rule-width: medium;
  }
  #container {
    border-style: solid; /* Avoid border-*-width computed style 0px */
  }
  #target {
    border-style: solid; /* Avoid border-*-width computed style 0px */
  }
</style>
<script>
const transparentColor = 'rgba(0, 0, 0, 0)'; // https://www.w3.org/TR/css-color-3/#transparent
const mediumWidth = getComputedStyle(document.getElementById('reference')).columnRuleWidth; // e.g. 3px
const currentColor = 'rgb(2, 3, 4)';
container.style.color = currentColor;


// assert_not_inherited accepts: property name, expected initial value, another value the property supports.
assert_not_inherited('background-attachment', 'scroll', 'fixed');
assert_not_inherited('background-clip', 'border-box', 'padding-box');
assert_not_inherited('background-color', transparentColor, 'rgb(42, 53, 64)');
assert_not_inherited('background-image', 'none', 'url("https://{{host}}/")');
assert_not_inherited('background-origin', 'padding-box', 'content-box');
assert_not_inherited('background-position', '0% 0%', '10px 20px');
assert_not_inherited('background-position-x', '0%', '10px');
assert_not_inherited('background-position-y', '0%', '20px');
assert_not_inherited('background-repeat', 'repeat', 'space round');
assert_not_inherited('background-size', 'auto', 'contain');

assert_not_inherited('border-bottom-color', currentColor, 'rgb(42, 53, 64)');
assert_not_inherited('border-bottom-left-radius', '0px', '5px 7%');
assert_not_inherited('border-bottom-right-radius', '0px', '5px 7%');
assert_not_inherited('border-bottom-style', 'none', 'dashed');
assert_not_inherited('border-bottom-width', mediumWidth, '10px');

assert_not_inherited('border-image-outset', '0', '1px 2px 3px 4px');
assert_not_inherited('border-image-repeat', 'stretch', 'repeat round');
assert_not_inherited('border-image-slice', '100%', '1% 2% 3% 4% fill');
assert_not_inherited('border-image-source', 'none', 'url("https://{{host}}/")');
assert_not_inherited('border-image-width', '1', '1px 2px 3px 4px');

assert_not_inherited('border-left-color', currentColor, 'rgb(42, 53, 64)');
assert_not_inherited('border-left-style', 'none', 'dashed');
assert_not_inherited('border-left-width', mediumWidth, '10px');

assert_not_inherited('border-right-color', currentColor, 'rgb(42, 53, 64)');
assert_not_inherited('border-right-style', 'none', 'dashed');
assert_not_inherited('border-right-width', mediumWidth, '10px');

assert_not_inherited('border-top-color', currentColor, 'rgb(42, 53, 64)');
assert_not_inherited('border-top-left-radius', '0px', '5px 7%');
assert_not_inherited('border-top-right-radius', '0px', '5px 7%');
assert_not_inherited('border-top-style', 'none', 'dashed');
assert_not_inherited('border-top-width', mediumWidth, '10px');

assert_not_inherited('box-shadow', 'none', 'rgb(42, 53, 64) 1px 2px 3px 4px');
</script>
</body>
</html>