Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 9670e22

Browse files
committed
Fix textDecoration being set to an empty string if the text has no decoration.
1 parent 2403769 commit 9670e22

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/TextComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function getStyle (colormap, { color, bold, italic, underlined, strikethrough })
77
color: color && colormap[color],
88
fontWeight: bold && 'bold',
99
fontStyle: italic && 'italic',
10-
textDecoration: `${underlined ? 'underline' : ''} ${strikethrough ? 'line-through' : ''}`
10+
textDecoration: (underlined || strikethrough) && `${underlined ? 'underline' : ''} ${strikethrough ? 'line-through' : ''}`
1111
}
1212
}
1313

src/__snapshots__/McText.spec.js.snap

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports[`test Formatting codes text renders properly 1`] = `
1111
"color": undefined,
1212
"fontStyle": undefined,
1313
"fontWeight": undefined,
14-
"textDecoration": " ",
14+
"textDecoration": undefined,
1515
}
1616
}>
1717
@@ -21,7 +21,7 @@ exports[`test Formatting codes text renders properly 1`] = `
2121
"color": "#aa0000",
2222
"fontStyle": undefined,
2323
"fontWeight": undefined,
24-
"textDecoration": " ",
24+
"textDecoration": undefined,
2525
}
2626
}>
2727
This is red and this is
@@ -32,7 +32,7 @@ exports[`test Formatting codes text renders properly 1`] = `
3232
"color": "#aa0000",
3333
"fontStyle": undefined,
3434
"fontWeight": undefined,
35-
"textDecoration": " ",
35+
"textDecoration": undefined,
3636
}
3737
}>
3838
<span>
@@ -45,7 +45,7 @@ exports[`test Formatting codes text renders properly 1`] = `
4545
"color": undefined,
4646
"fontStyle": undefined,
4747
"fontWeight": undefined,
48-
"textDecoration": " ",
48+
"textDecoration": undefined,
4949
}
5050
}>
5151
and
@@ -56,7 +56,7 @@ exports[`test Formatting codes text renders properly 1`] = `
5656
"color": undefined,
5757
"fontStyle": undefined,
5858
"fontWeight": "bold",
59-
"textDecoration": " ",
59+
"textDecoration": undefined,
6060
}
6161
}>
6262
bold. Note that
@@ -67,7 +67,7 @@ exports[`test Formatting codes text renders properly 1`] = `
6767
"color": "#5555ff",
6868
"fontStyle": undefined,
6969
"fontWeight": undefined,
70-
"textDecoration": " ",
70+
"textDecoration": undefined,
7171
}
7272
}>
7373
color codes reset format codes, as you
@@ -78,7 +78,7 @@ exports[`test Formatting codes text renders properly 1`] = `
7878
"color": "#5555ff",
7979
"fontStyle": "italic",
8080
"fontWeight": undefined,
81-
"textDecoration": " ",
81+
"textDecoration": undefined,
8282
}
8383
}>
8484
can see.
@@ -100,7 +100,7 @@ exports[`test JSON text component renders properly 1`] = `
100100
"color": undefined,
101101
"fontStyle": undefined,
102102
"fontWeight": undefined,
103-
"textDecoration": " ",
103+
"textDecoration": undefined,
104104
}
105105
}>
106106
@@ -110,7 +110,7 @@ exports[`test JSON text component renders properly 1`] = `
110110
"color": "#aa0000",
111111
"fontStyle": undefined,
112112
"fontWeight": undefined,
113-
"textDecoration": " ",
113+
"textDecoration": undefined,
114114
}
115115
}>
116116
<span>
@@ -123,7 +123,7 @@ exports[`test JSON text component renders properly 1`] = `
123123
"color": "#55ff55",
124124
"fontStyle": undefined,
125125
"fontWeight": undefined,
126-
"textDecoration": " ",
126+
"textDecoration": undefined,
127127
}
128128
}>
129129
|
@@ -134,7 +134,7 @@ exports[`test JSON text component renders properly 1`] = `
134134
"color": "#aa0000",
135135
"fontStyle": undefined,
136136
"fontWeight": undefined,
137-
"textDecoration": " ",
137+
"textDecoration": undefined,
138138
}
139139
}>
140140
SKY-Server
@@ -145,7 +145,7 @@ exports[`test JSON text component renders properly 1`] = `
145145
"color": "#55ff55",
146146
"fontStyle": undefined,
147147
"fontWeight": undefined,
148-
"textDecoration": " ",
148+
"textDecoration": undefined,
149149
}
150150
}>
151151
|
@@ -156,7 +156,7 @@ exports[`test JSON text component renders properly 1`] = `
156156
"color": "#aa0000",
157157
"fontStyle": undefined,
158158
"fontWeight": undefined,
159-
"textDecoration": " ",
159+
"textDecoration": undefined,
160160
}
161161
}>
162162
Minigames
@@ -167,7 +167,7 @@ exports[`test JSON text component renders properly 1`] = `
167167
"color": "#55ff55",
168168
"fontStyle": undefined,
169169
"fontWeight": undefined,
170-
"textDecoration": " ",
170+
"textDecoration": undefined,
171171
}
172172
}>
173173
|
@@ -178,7 +178,7 @@ exports[`test JSON text component renders properly 1`] = `
178178
"color": "#aa0000",
179179
"fontStyle": undefined,
180180
"fontWeight": undefined,
181-
"textDecoration": " ",
181+
"textDecoration": undefined,
182182
}
183183
}>
184184
Creative
@@ -189,7 +189,7 @@ exports[`test JSON text component renders properly 1`] = `
189189
"color": "#55ff55",
190190
"fontStyle": undefined,
191191
"fontWeight": undefined,
192-
"textDecoration": " ",
192+
"textDecoration": undefined,
193193
}
194194
}>
195195
|
@@ -200,7 +200,7 @@ exports[`test JSON text component renders properly 1`] = `
200200
"color": "#ff5555",
201201
"fontStyle": undefined,
202202
"fontWeight": undefined,
203-
"textDecoration": " ",
203+
"textDecoration": undefined,
204204
}
205205
}>
206206
Community von 8 - 66 Jahren
@@ -211,7 +211,7 @@ exports[`test JSON text component renders properly 1`] = `
211211
"color": "#55ff55",
212212
"fontStyle": undefined,
213213
"fontWeight": undefined,
214-
"textDecoration": " ",
214+
"textDecoration": undefined,
215215
}
216216
}>
217217
|
@@ -222,7 +222,7 @@ exports[`test JSON text component renders properly 1`] = `
222222
"color": "#aa0000",
223223
"fontStyle": undefined,
224224
"fontWeight": undefined,
225-
"textDecoration": " ",
225+
"textDecoration": undefined,
226226
}
227227
}>
228228
Aktive Admins
@@ -244,7 +244,7 @@ exports[`test JSON text component with string extra components renders properly
244244
"color": undefined,
245245
"fontStyle": undefined,
246246
"fontWeight": undefined,
247-
"textDecoration": " ",
247+
"textDecoration": undefined,
248248
}
249249
}>
250250
This
@@ -257,7 +257,7 @@ exports[`test JSON text component with string extra components renders properly
257257
"color": "#ff5555",
258258
"fontStyle": undefined,
259259
"fontWeight": undefined,
260-
"textDecoration": " ",
260+
"textDecoration": undefined,
261261
}
262262
}>
263263
great!

0 commit comments

Comments
 (0)