summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/parsing/grid-template-shorthand.html
blob: b9165359a7250afab60463878b9beb8592424f58 (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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: grid-template sets longhands</title>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template">
<meta name="assert" content="grid-template supports the full grammar 'none | [ <grid-template-rows> / <grid-template-columns> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/shorthand-testcommon.js"></script>
</head>
<body>
<script>
test_shorthand_value('grid-template', 'none', {
  'grid-template-rows': 'none',
  'grid-template-columns': 'none',
  'grid-template-areas': 'none'
});

// <grid-template-rows> / <grid-template-columns>
test_shorthand_value('grid-template', '10px / 20%', {
  'grid-template-rows': '10px',
  'grid-template-columns': '20%',
  'grid-template-areas': 'none'
});

test_shorthand_value('grid-template', 'fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))', {
  'grid-template-rows': 'fit-content(calc(-0.5em + 10px))',
  'grid-template-columns': 'fit-content(calc(0.5em + 10px))',
  'grid-template-areas': 'none'
});

// [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?
test_shorthand_value('grid-template',
                     '[header-top] "a a a"     [header-bottom]' +
                     '  [main-top] "b b b" 1fr [main-bottom]' +
                     '           / auto 1fr auto', {
  'grid-template-rows': '[header-top] auto [header-bottom main-top] 1fr [main-bottom]',
  'grid-template-columns': 'auto 1fr auto',
  'grid-template-areas': '"a a a" "b b b"'
});

test_shorthand_value('grid-template',
                     '  "a a a"' +
                     '  "b b b" 1fr' +
                     '/ auto 1fr auto', {
  'grid-template-rows': 'auto 1fr',
  'grid-template-columns': 'auto 1fr auto',
  'grid-template-areas': '"a a a" "b b b"'
});

test_shorthand_value('grid-template',
                     ' [] "a a a"     []' +
                     ' [] "b b b" 1fr []' +
                     '  / [] auto 1fr [] auto []', {
  'grid-template-rows': 'auto 1fr',
  'grid-template-columns': 'auto 1fr auto',
  'grid-template-areas': '"a a a" "b b b"'
});
</script>
</body>
</html>