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
|
/* 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 `text-wrap: balance` test cases.
const LOREM_IPSUM = `
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec a diam lectus. Sed sit amet ipsum mauris.
Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit.
`;
export default [
{
info: "text-wrap: balance; is inactive when line number exceeds threshold",
property: "text-wrap",
createTestElement: rootNode => {
const element = document.createElement("div");
element.textContent = LOREM_IPSUM;
rootNode.append(element);
return element;
},
tagName: "div",
rules: ["div { text-wrap: balance; width: 100px; }"],
isActive: false,
},
{
info: "text-wrap: balance; is active when line number is below threshold",
property: "text-wrap",
createTestElement: rootNode => {
const element = document.createElement("div");
element.textContent = LOREM_IPSUM;
rootNode.append(element);
return element;
},
tagName: "div",
rules: ["div { text-wrap: balance; width: 300px; }"],
isActive: true,
},
{
info: "text-wrap: balance is inactive when element is fragmented",
property: "text-wrap",
createTestElement: rootNode => {
const element = document.createElement("div");
element.textContent = `
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec a diam lectus. Sed sit amet ipsum mauris.
Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit.
`;
rootNode.append(element);
return element;
},
tagName: "div",
rules: ["div { text-wrap: balance; column-count: 2; }"],
isActive: false,
},
{
info: "text-wrap: balance; does not throw if element is not a block",
property: "text-wrap",
createTestElement: rootNode => {
const element = document.createElement("div");
element.textContent = LOREM_IPSUM;
rootNode.append(element);
return element;
},
tagName: "div",
rules: ["div { text-wrap: balance; display: inline; }"],
isActive: true,
},
{
info: "text-wrap: initial; is active",
property: "text-wrap",
createTestElement: rootNode => {
const element = document.createElement("div");
element.textContent = `
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec a diam lectus. Sed sit amet ipsum mauris.
Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit.
`;
rootNode.append(element);
return element;
},
tagName: "div",
rules: ["div { text-wrap: initial; width: 100px; }"],
isActive: true,
},
];
|