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
151
152
153
154
155
156
157
158
159
160
161
162
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// InactivePropertyHelper `border-image` test cases.
export default [
{
info: "border-image is active on another element then a table element or internal table element where border-collapse is not set to collapse",
property: "border-image",
tagName: "div",
rules: ["div { border-image: linear-gradient(red, yellow) 10; }"],
isActive: true,
},
{
info: "border-image is active on another element then a table element or internal table element where border-collapse is set to collapse",
property: "border-image",
tagName: "div",
rules: [
"div { border-image: linear-gradient(red, yellow) 10; border-collapse: collapse;}",
],
isActive: true,
},
{
info: "border-image is active on a td element with no table parent and the browser is not crashing",
property: "border-image",
tagName: "td",
rules: [
"td { border-image: linear-gradient(red, yellow) 10; border-collapse: collapse;}",
],
isActive: true,
},
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: false,
borderCollapse: true,
borderCollapsePropertyIsInherited: false,
isActive: true,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: false,
borderCollapse: false,
borderCollapsePropertyIsInherited: false,
isActive: true,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: false,
borderCollapse: true,
borderCollapsePropertyIsInherited: true,
isActive: false,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: false,
borderCollapse: false,
borderCollapsePropertyIsInherited: true,
isActive: true,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: true,
borderCollapse: true,
borderCollapsePropertyIsInherited: false,
isActive: true,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: true,
borderCollapse: false,
borderCollapsePropertyIsInherited: false,
isActive: true,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: true,
borderCollapse: true,
borderCollapsePropertyIsInherited: true,
isActive: false,
}),
createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle: true,
borderCollapse: false,
borderCollapsePropertyIsInherited: true,
isActive: true,
}),
];
/**
* @param {Object} testParameters
* @param {bool} testParameters.useDivTagWithDisplayTableStyle use generic divs using display property instead of actual table/tr/td tags
* @param {bool} testParameters.borderCollapse is `border-collapse` property set to `collapse` ( instead of `separate`)
* @param {bool} testParameters.borderCollapsePropertyIsInherited should the border collapse property be inherited from the table parent (instead of directly set on the internal table element)
* @param {bool} testParameters.isActive is the border-image property actve on the element
* @returns
*/
function createTableElementsToTestBorderImage({
useDivTagWithDisplayTableStyle,
borderCollapse,
borderCollapsePropertyIsInherited,
isActive,
}) {
return {
info: `border-image is ${
isActive ? "active" : "inactive"
} on an internal table element where border-collapse is${
borderCollapse ? "" : " not"
} set to collapse${
borderCollapsePropertyIsInherited
? " by being inherited from its table parent"
: ""
} when the table and its internal elements are ${
useDivTagWithDisplayTableStyle ? "not " : ""
}using semantic tags (table, tr, td, ...)`,
property: "border-image",
createTestElement: rootNode => {
const table = useDivTagWithDisplayTableStyle
? document.createElement("div")
: document.createElement("table");
if (useDivTagWithDisplayTableStyle) {
table.style.display = "table";
}
if (borderCollapsePropertyIsInherited) {
table.style.borderCollapse = `${
borderCollapse ? "collapse" : "separate"
}`;
}
rootNode.appendChild(table);
const tbody = useDivTagWithDisplayTableStyle
? document.createElement("div")
: document.createElement("tbody");
if (useDivTagWithDisplayTableStyle) {
tbody.style.display = "table-row-group";
}
table.appendChild(tbody);
const tr = useDivTagWithDisplayTableStyle
? document.createElement("div")
: document.createElement("tr");
if (useDivTagWithDisplayTableStyle) {
tr.style.display = "table-row";
}
tbody.appendChild(tr);
const td = useDivTagWithDisplayTableStyle
? document.createElement("div")
: document.createElement("td");
if (useDivTagWithDisplayTableStyle) {
td.style.display = "table-cell";
td.classList.add("td");
}
tr.appendChild(td);
return td;
},
rules: [
`td, .td {
border-image: linear-gradient(red, yellow) 10;
${
!borderCollapsePropertyIsInherited
? `border-collapse: ${borderCollapse ? "collapse" : "separate"};`
: ""
}
}`,
],
isActive,
};
}
|