summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/parsing/grid-template-rows-computed-withcontent.html
blob: 693cf338c0dc42406336ccd99a605b1cf0d4f9be (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
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: getComputedStyle().gridTemplateRows</title>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-rows">
<meta name="assert" content="grid-template-rows computed value is the keyword none or a computed track list.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
  #target {
    display: grid;
    font-size: 40px;
    min-width: 200px;
    width: 300px;
    max-width: 400px;
    min-height: 500px;
    height: 600px;
    max-height: 700px;
  }
  #child {
    min-width: 20px;
    width: 30px;
    max-width: 40px;
    min-height: 50px;
    height: 60px;
    max-height: 70px;
  }
</style>
</head>
<body>
<div id="container">
  <div id="target">
    <div id="child"></div>
  </div>
</div>
<script>
test_computed_value("grid-template-rows", 'none', '600px'); // "none" without #child

// track-size <fixed-breadth> = <length-percentage> | <flex> | min-content | max-content | auto
test_computed_value("grid-template-rows", '20%', '120px'); // 20% * height
test_computed_value("grid-template-rows", 'calc(-0.5em + 10px)', '0px');
test_computed_value("grid-template-rows", 'calc(0.5em + 10px)', '30px');
test_computed_value("grid-template-rows", 'calc(30% + 40px)', '220px'); // 30% * height + 40px
test_computed_value("grid-template-rows", '5fr', '600px'); // height
test_computed_value("grid-template-rows", 'min-content', '60px');
test_computed_value("grid-template-rows", 'max-content', '60px');
test_computed_value("grid-template-rows", 'auto', '600px'); // height

// track-size minmax( <inflexible-breadth> , <track-breadth> )
test_computed_value("grid-template-rows", 'minmax(10px, auto)', '600px'); // height
test_computed_value("grid-template-rows", 'minmax(20%, max-content)', '120px'); // 20% * height
test_computed_value("grid-template-rows", 'minmax(min-content, calc(-0.5em + 10px))', '60px');
test_computed_value("grid-template-rows", 'minmax(auto, 0)', '60px');

// track-size fit-content( <length-percentage> )
test_computed_value("grid-template-rows", 'fit-content(70px)', '60px');
test_computed_value("grid-template-rows", 'fit-content(20%)', '60px');
test_computed_value("grid-template-rows", 'fit-content(calc(-0.5em + 10px))', '60px');

// <track-repeat> = repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )
test_computed_value("grid-template-rows", 'repeat(1, 10px)', '10px');
test_computed_value("grid-template-rows", 'repeat(1, [one two] 20%)', '[one two] 120px');
test_computed_value("grid-template-rows", 'repeat(2, minmax(10px, auto))', '325px 275px');

test_computed_value("grid-template-rows", 'repeat(2, fit-content(20%) [three four] 30px 40px [five six])',
                    '60px [three four] 30px 40px [five six] 0px [three four] 30px 40px [five six]');

// <track-list> = [ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?
test_computed_value("grid-template-rows", 'min-content repeat(5, minmax(10px, auto))',
                    '60px 108px 108px 108px 108px 108px');
test_computed_value("grid-template-rows", '[] 150px [] 1fr []', '150px 450px');

// <auto-repeat> = repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )
test_computed_value("grid-template-rows", 'repeat(auto-fill, 200px)', '200px 200px 200px');
test_computed_value("grid-template-rows", 'repeat(auto-fit, [one] 20%)',
                    '[one] 120px [one] 0px [one] 0px [one] 0px [one] 0px');
test_computed_value("grid-template-rows", 'repeat(auto-fill, minmax(100px, 5fr) [two])',
                    '100px [two] 100px [two] 100px [two] 100px [two] 100px [two] 100px [two]');
test_computed_value("grid-template-rows", 'repeat(auto-fit, [three] minmax(max-content, 6em) [four])',
                    '[three] 240px [four three] 0px [four]');

// <auto-track-list> =
// [ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?
// <auto-repeat>
// [ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?

test_computed_value("grid-template-rows", '[one] repeat(2, minmax(50px, auto)) [two] 30px [three] repeat(auto-fill, 10px) 40px [four five] repeat(2, minmax(200px, auto)) [six]',
                    '[one] 50px 50px [two] 30px [three] 10px 10px 10px 40px [four five] 200px 200px [six]');
</script>
</body>
</html>