summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/parsing/grid-template-columns-valid.html
blob: 6bf2e7bce63c88d028f5dea1bf3e7be8cab7775c (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>CSS Grid Layout Test: parsing grid-template-columns with valid values</title>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-columns">
<meta name="assert" content="grid-template-columns supports the full grammar 'none | <track-list> | <auto-track-list>'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("grid-template-columns", "none");

// track-size <fixed-breadth> = <length-percentage> | <flex> | min-content | max-content | auto
test_valid_value("grid-template-columns", '10px');
test_valid_value("grid-template-columns", '20%');
test_valid_value("grid-template-columns", 'calc(-0.5em + 10px)');
test_valid_value("grid-template-columns", 'calc(0.5em + 10px)');
test_valid_value("grid-template-columns", 'calc(30% + 40vw)');
test_valid_value("grid-template-columns", '5fr');
test_valid_value("grid-template-columns", 'min-content');
test_valid_value("grid-template-columns", 'max-content');
test_valid_value("grid-template-columns", 'auto');

// track-size minmax( <inflexible-breadth> , <track-breadth> )
test_valid_value("grid-template-columns", 'minmax(10px, auto)');
test_valid_value("grid-template-columns", 'minmax(20%, max-content)');
test_valid_value("grid-template-columns", 'minmax(calc(-0.5em + 10px), min-content)');
test_valid_value("grid-template-columns", 'minmax(calc(0.5em + 10px), 5fr)');
test_valid_value("grid-template-columns", 'minmax(calc(30% + 40vw), 10px)');
test_valid_value("grid-template-columns", 'minmax(min-content, 20%)');
test_valid_value("grid-template-columns", 'minmax(max-content, calc(-0.5em + 10px))');
test_valid_value("grid-template-columns", 'minmax(auto, calc(0.5em + 10px))');

// track-size fit-content( <length-percentage> )
test_valid_value("grid-template-columns", 'fit-content(10px)');
test_valid_value("grid-template-columns", 'fit-content(20%)');
test_valid_value("grid-template-columns", 'fit-content(calc(-0.5em + 10px))');
test_valid_value("grid-template-columns", 'fit-content(calc(0.5em + 10px))');
test_valid_value("grid-template-columns", 'fit-content(calc(30% + 40vw))');

// <track-repeat> = repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )

// 'repeat(1, [] 10px)' in Blink
// 'repeat(1, 10px)' in Firefox
// '[] 10px' in Safari
// '10px' in Edge 18
test_valid_value("grid-template-columns", 'repeat(1, [] 10px [])', 'repeat(1, 10px)');

// 'repeat(1, [one two] 20%)' in Blink, Firefox
// '[one two] 20%' in Safari, Edge 18
test_valid_value("grid-template-columns", 'repeat(1, [one two] 20%)');

// 'repeat(2, minmax(10px, auto))' in Blink, Firefox, Edge 18
// 'minmax(10px, auto) minmax(10px, auto)' in Safari
test_valid_value("grid-template-columns", 'repeat(2, minmax(10px, auto))');

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

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

// <auto-repeat> = repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )
test_valid_value("grid-template-columns", 'repeat(auto-fill, 10px)');
test_valid_value("grid-template-columns", 'repeat(auto-fit, [one] 20%)');
test_valid_value("grid-template-columns", 'repeat(auto-fill, minmax(30px, 5fr) [two])');
test_valid_value("grid-template-columns", 'repeat(auto-fit, [three] minmax(max-content, 6em) [four])');

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

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