summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-tables/html5-table-formatting-2.html
blob: 4292c4c76fd1c6325788f20ded00fb69a2fe399e (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!doctype html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<link rel='stylesheet' href='./support/base.css' />
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#missing-cells-fixup">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#dimensioning-the-row-column-grid">
<main>

    <h1>HTML5 Table Formatting algorithm (row/column grid computation)</h1>
    <p>Verifies how browsers deal with explicit tracks from which no cell does originate</p>

    <hr/>
    <p>This should be a 100px by 100px blue square:</p>
    <p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
    <p>The consecutive tracks are not merged together because they are all defined explicitely by a table-column or a table-row</p>
    <x-table style="background: blue;">
        <x-col style="width: 50px"></x-col>
        <x-col style="width: 50px"></x-col>
        <x-tr style="height: 50px"></x-tr>
        <x-tr style="height: 50px"></x-tr>
    </x-table>

    <hr/>
    <p>This should be a 175px by 175px blue square:</p>
    <p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
    <p>The consecutive tracks are not merged together because they are all defined explicitely by a table-column or a table-row</p>
    <p>Three 25px border-spacing causes the addition of 75px</p>
    <x-table style="background: blue; border-spacing: 25px">
        <x-col style="width: 50px"></x-col>
        <x-col style="width: 50px"></x-col>
        <x-tr style="height: 50px"></x-tr>
        <x-tr style="height: 50px"></x-tr>
    </x-table>

    <hr/>
    <p>This should be a 175px by 175px blue square:</p>
    <p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
    <p>The consecutive tracks are not merged together because they are all defined explicitely by a table-column or a table-row</p>
    <p>Three 25px border-spacing causes the addition of 75px</p>
    <x-table style="background: blue; border-spacing: 25px">
        <x-col style="width: 50px"></x-col>
        <x-col style="width: 50px"></x-col>
        <x-tr style="height: 50px"><x-td></x-td><x-td></x-td></x-tr>
        <x-tr style="height: 50px"></x-tr>
    </x-table>

    <hr/>
    <p>This should be a 175px by 175px blue square:</p>
    <p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
    <p>The consecutive tracks are not merged together because they are all defined explicitely by a table-column or a table-row</p>
    <p>Three 25px border-spacing causes the addition of 75px</p>
    <x-table style="background: blue; border-spacing: 25px">
        <x-col style="width: 50px"></x-col>
        <x-col style="width: 50px"></x-col>
        <x-tr style="height: 50px"></x-tr>
        <x-tr style="height: 50px"><x-td></x-td><x-td></x-td></x-tr>
    </x-table>

    <hr/>
    <p>This should be a 175px by 175px blue square:</p>
    <p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
    <p>The consecutive tracks are not merged together because they are all defined explicitely by a table-column or a table-row</p>
    <p>Three 25px border-spacing causes the addition of 75px</p>
    <x-table style="background: blue; border-spacing: 25px">
        <x-col style="width: 50px"></x-col>
        <x-col style="width: 50px"></x-col>
        <x-tr style="height: 50px"><x-td></x-td><x-td></x-td></x-tr>
        <x-tr style="height: 50px"><x-td></x-td><x-td></x-td></x-tr>
    </x-table>

    <hr/>
    <p>This should be a 175px by 175px blue square:</p>
    <p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
    <p>The consecutive tracks are not merged together because they are all defined explicitely by a table-column or a table-row</p>
    <p>Three 25px border-spacing causes the addition of 75px</p>
    <x-table style="background: blue; border-spacing: 25px">
        <x-col style="width: 50px"></x-col>
        <x-col style="width: 50px"></x-col>
        <x-tr style="height: 50px"><x-td></x-td></x-tr>
        <x-tr style="height: 50px"><x-td></x-td></x-tr>
    </x-table>

</main>

<script>

    generate_tests(assert_equals, [
        [
            "Explicitely defined columns are not merged",
            document.querySelector("x-table:nth-of-type(1)").offsetWidth,
            100
        ],
        [
            "Explicitely defined rows are not merged",
            document.querySelector("x-table:nth-of-type(1)").offsetHeight,
            100
        ],
        [
            "Border-spacing is added between any two unmerged columns (1)",
            document.querySelector("x-table:nth-of-type(2)").offsetWidth,
            175
        ],
        [
            "Border-spacing is added between any two unmerged rows (1)",
            document.querySelector("x-table:nth-of-type(2)").offsetHeight,
            175
        ],
        [
            "Border-spacing is added between any two unmerged columns (2)",
            document.querySelector("x-table:nth-of-type(3)").offsetWidth,
            175
        ],
        [
            "Border-spacing is added between any two unmerged rows (2)",
            document.querySelector("x-table:nth-of-type(3)").offsetHeight,
            175
        ],
        [
            "Border-spacing is added between any two unmerged columns (3)",
            document.querySelector("x-table:nth-of-type(4)").offsetWidth,
            175
        ],
        [
            "Border-spacing is added between any two unmerged rows (3)",
            document.querySelector("x-table:nth-of-type(4)").offsetHeight,
            175
        ],
        [
            "Border-spacing is added between any two unmerged columns (4)",
            document.querySelector("x-table:nth-of-type(5)").offsetWidth,
            175
        ],
        [
            "Border-spacing is added between any two unmerged rows (4)",
            document.querySelector("x-table:nth-of-type(5)").offsetHeight,
            175
        ],
        [
            "Border-spacing is added between any two unmerged columns (5)",
            document.querySelector("x-table:nth-of-type(6)").offsetWidth,
            175
        ],
        [
            "Border-spacing is added between any two unmerged rows (5)",
            document.querySelector("x-table:nth-of-type(6)").offsetHeight,
            175
        ],
    ])

</script>