-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexamples.js
136 lines (135 loc) · 3.44 KB
/
examples.js
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
// @ts-check
/**
* @typedef {Object} RenderingTestCase
* @property {string} name - The name of the test case.
* @property {string} [description] - The description of the test case. (Optional)
* @property {*} value - The value to be rendered.
* @property {[string, string][]} [attributes] - Optional attributes for the test case.
*/
/**
* Array of rendering test cases.
* @type {RenderingTestCase[]}
*/
export const TEST_CASES = [
{
name: "Simple Example",
value: {
hello: "world",
value: 42,
enabled: true,
extra: null,
nested: { key: "value" },
},
},
{
name: "Expanded",
description:
"An object with `expand` attribute set to `2`. This will expand the object to 2 levels.",
value: {
hello: "world",
value: 42,
enabled: true,
extra: null,
nested: { key: "value" },
},
attributes: [["expand", "2"]],
},
{
name: "Collapsed",
description:
"An object with `expand` attribute set to `0`. This will collapse the object.",
value: {
hello: "world",
value: 42,
enabled: true,
extra: null,
nested: { key: "value" },
},
},
{
name: "Themed",
description: "An object with custom styles applied.",
attributes: [
[
"style",
`
--key-color: rebeccapurple;
--arrow-color: blue;
--brace-color: magenta;
--bracket-color: purple;
--indent: 4rem;
`
.trim()
.replace(/\n\s+/g, " "),
],
],
value: {
hello: "world",
value: 42,
enabled: true,
extra: null,
nested: { key: "value" },
},
},
{
name: "String",
description:
"A simple string value. All primitive types are supported as long as they are valid JSON.",
value: "example string",
},
{
name: "Number",
description: "A simple number value.",
value: 3232323,
},
{
name: "Boolean (true)",
description: "A boolean value with the value `true`.",
value: true,
},
{
name: "Null",
description: "A null value.",
value: null,
},
{
name: "URL string",
description: "A string containing a URL.",
value: "https://example.com",
},
{
name: "deeply nested object",
description: "An object with multiple levels of nesting.",
value: {
deeply: { nested: { object: { with: { lots: { of: "levels" } } } } },
},
},
{
name: "object with very long key names",
value: {
/** @type {string} */
"this is a very long key name that should be truncated": "value",
/** @type {string} */
"another very long key name that should be truncated": "value",
/** @type {string} */
"yet another very long key name that should be truncated": "value",
},
},
{
name: "Long string",
description: "A long string that will be truncated.",
value:
"This long string is truncated. Clicking on ellipsis will expand it. lorem ipsum sit dolor amet consectetur adipis elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua".repeat(
200
),
},
{
name: "Long string with custom truncation",
description: "A long string that will be truncated with a custom length.",
attributes: [["truncate-string", "700"]],
value:
"lorem ipsum sit dolor amet consectetur adipis elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua".repeat(
200
),
},
];