Skip to content

Commit aa51db8

Browse files
committed
Added/updated tests
1 parent 6aa495c commit aa51db8

File tree

8 files changed

+465
-22
lines changed

8 files changed

+465
-22
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<p>Paragraph 1</p>
2+
<p>
3+
<span
4+
class="mention-external"
5+
data-external="true"
6+
data-inline-content-type="mention"
7+
data-user="User"
8+
>@User</span>
9+
</p>
10+
<p>Paragraph 2</p>

tests/src/unit/core/clipboard/copy/copyTestInstances.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,4 +650,30 @@ export const copyTestInstancesHTML: TestInstance<
650650
},
651651
executeTest: testCopyHTML,
652652
},
653+
{
654+
testCase: {
655+
name: "mentionWithBackgroundColor",
656+
document: [
657+
{
658+
type: "paragraph",
659+
content: "Paragraph 1",
660+
},
661+
{
662+
type: "paragraph",
663+
content: [{ type: "mention", props: { user: "User" } }],
664+
},
665+
{
666+
type: "paragraph",
667+
content: "Paragraph 2",
668+
},
669+
],
670+
getCopySelection: (doc) => {
671+
const startPos = getPosOfTextNode(doc, "Paragraph 1");
672+
const endPos = getPosOfTextNode(doc, "Paragraph 2", true);
673+
674+
return TextSelection.create(doc, startPos, endPos);
675+
},
676+
},
677+
executeTest: testCopyHTML,
678+
},
653679
];

tests/src/unit/core/formatConversion/export/__snapshots__/blocknoteHTML/inlineContent/mentionWithToExternalHTML.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<span
88
class="mention-internal"
99
data-user="Matthew"
10+
style="background-color: red;"
1011
data-inline-content-type="mention"
1112
>@Matthew</span>
1213
</p>

tests/src/unit/core/formatConversion/export/__snapshots__/html/inlineContent/mentionWithToExternalHTML.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
data-external="true"
66
data-inline-content-type="mention"
77
data-user="Matthew"
8+
style="background-color: red;"
89
>@Matthew</span>
910
</p>

tests/src/unit/core/formatConversion/parse/__snapshots__/html/googleDocs.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"content": [
55
{
66
"styles": {
7+
"backgroundColor": "transparent",
78
"bold": true,
89
"textColor": "rgb(0, 0, 0)",
910
},
@@ -26,6 +27,7 @@
2627
"content": [
2728
{
2829
"styles": {
30+
"backgroundColor": "transparent",
2931
"bold": true,
3032
"textColor": "rgb(0, 0, 0)",
3133
},
@@ -48,6 +50,7 @@
4850
"content": [
4951
{
5052
"styles": {
53+
"backgroundColor": "transparent",
5154
"bold": true,
5255
"textColor": "rgb(0, 0, 0)",
5356
},
@@ -70,6 +73,7 @@
7073
"content": [
7174
{
7275
"styles": {
76+
"backgroundColor": "transparent",
7377
"bold": true,
7478
"textColor": "rgb(0, 0, 0)",
7579
},
@@ -92,6 +96,7 @@
9296
"content": [
9397
{
9498
"styles": {
99+
"backgroundColor": "transparent",
95100
"bold": true,
96101
"textColor": "rgb(0, 0, 0)",
97102
},
@@ -114,6 +119,7 @@
114119
"content": [
115120
{
116121
"styles": {
122+
"backgroundColor": "transparent",
117123
"bold": true,
118124
"textColor": "rgb(0, 0, 0)",
119125
},
@@ -136,6 +142,7 @@
136142
"content": [
137143
{
138144
"styles": {
145+
"backgroundColor": "transparent",
139146
"textColor": "rgb(0, 0, 0)",
140147
},
141148
"text": "Paragraph 1",
@@ -155,6 +162,7 @@
155162
"content": [
156163
{
157164
"styles": {
165+
"backgroundColor": "transparent",
158166
"textColor": "rgb(0, 0, 0)",
159167
},
160168
"text": "Paragraph 2",
@@ -174,6 +182,7 @@
174182
"content": [
175183
{
176184
"styles": {
185+
"backgroundColor": "transparent",
177186
"textColor": "rgb(0, 0, 0)",
178187
},
179188
"text": "Paragraph 3",
@@ -193,6 +202,7 @@
193202
"content": [
194203
{
195204
"styles": {
205+
"backgroundColor": "transparent",
196206
"textColor": "rgb(0, 0, 0)",
197207
},
198208
"text": "Paragraph With
@@ -213,6 +223,7 @@ Hard Break",
213223
"content": [
214224
{
215225
"styles": {
226+
"backgroundColor": "transparent",
216227
"bold": true,
217228
"textColor": "rgb(0, 0, 0)",
218229
},
@@ -221,13 +232,15 @@ Hard Break",
221232
},
222233
{
223234
"styles": {
235+
"backgroundColor": "transparent",
224236
"textColor": "rgb(0, 0, 0)",
225237
},
226238
"text": " ",
227239
"type": "text",
228240
},
229241
{
230242
"styles": {
243+
"backgroundColor": "transparent",
231244
"italic": true,
232245
"textColor": "rgb(0, 0, 0)",
233246
},
@@ -236,13 +249,15 @@ Hard Break",
236249
},
237250
{
238251
"styles": {
252+
"backgroundColor": "transparent",
239253
"textColor": "rgb(0, 0, 0)",
240254
},
241255
"text": " Underline ",
242256
"type": "text",
243257
},
244258
{
245259
"styles": {
260+
"backgroundColor": "transparent",
246261
"strike": true,
247262
"textColor": "rgb(0, 0, 0)",
248263
},
@@ -251,13 +266,15 @@ Hard Break",
251266
},
252267
{
253268
"styles": {
269+
"backgroundColor": "transparent",
254270
"textColor": "rgb(0, 0, 0)",
255271
},
256272
"text": " ",
257273
"type": "text",
258274
},
259275
{
260276
"styles": {
277+
"backgroundColor": "transparent",
261278
"bold": true,
262279
"italic": true,
263280
"strike": true,
@@ -284,6 +301,7 @@ Hard Break",
284301
"content": [
285302
{
286303
"styles": {
304+
"backgroundColor": "transparent",
287305
"textColor": "rgb(0, 0, 0)",
288306
},
289307
"text": "Nested Numbered List Item 1",
@@ -303,6 +321,7 @@ Hard Break",
303321
"content": [
304322
{
305323
"styles": {
324+
"backgroundColor": "transparent",
306325
"textColor": "rgb(0, 0, 0)",
307326
},
308327
"text": "Nested Numbered List Item 2",
@@ -321,6 +340,7 @@ Hard Break",
321340
"content": [
322341
{
323342
"styles": {
343+
"backgroundColor": "transparent",
324344
"textColor": "rgb(0, 0, 0)",
325345
},
326346
"text": "Nested Bullet List Item 1",
@@ -340,6 +360,7 @@ Hard Break",
340360
"content": [
341361
{
342362
"styles": {
363+
"backgroundColor": "transparent",
343364
"textColor": "rgb(0, 0, 0)",
344365
},
345366
"text": "Nested Bullet List Item 2",
@@ -358,6 +379,7 @@ Hard Break",
358379
"content": [
359380
{
360381
"styles": {
382+
"backgroundColor": "transparent",
361383
"textColor": "rgb(0, 0, 0)",
362384
},
363385
"text": "Bullet List Item 1",
@@ -377,6 +399,7 @@ Hard Break",
377399
"content": [
378400
{
379401
"styles": {
402+
"backgroundColor": "transparent",
380403
"textColor": "rgb(0, 0, 0)",
381404
},
382405
"text": "Bullet List Item 2",
@@ -396,6 +419,7 @@ Hard Break",
396419
"content": [
397420
{
398421
"styles": {
422+
"backgroundColor": "transparent",
399423
"textColor": "rgb(0, 0, 0)",
400424
},
401425
"text": "Numbered List Item 1",
@@ -415,6 +439,7 @@ Hard Break",
415439
"content": [
416440
{
417441
"styles": {
442+
"backgroundColor": "transparent",
418443
"textColor": "rgb(0, 0, 0)",
419444
},
420445
"text": "Numbered List Item 2",
@@ -479,6 +504,7 @@ Hard Break",
479504
"content": [
480505
{
481506
"styles": {
507+
"backgroundColor": "transparent",
482508
"textColor": "rgb(0, 0, 0)",
483509
},
484510
"text": "Cell 1",
@@ -498,6 +524,7 @@ Hard Break",
498524
"content": [
499525
{
500526
"styles": {
527+
"backgroundColor": "transparent",
501528
"textColor": "rgb(0, 0, 0)",
502529
},
503530
"text": "Cell 2",
@@ -517,6 +544,7 @@ Hard Break",
517544
"content": [
518545
{
519546
"styles": {
547+
"backgroundColor": "transparent",
520548
"textColor": "rgb(0, 0, 0)",
521549
},
522550
"text": "Cell 3",
@@ -540,6 +568,7 @@ Hard Break",
540568
"content": [
541569
{
542570
"styles": {
571+
"backgroundColor": "transparent",
543572
"textColor": "rgb(0, 0, 0)",
544573
},
545574
"text": "Cell 4",
@@ -559,6 +588,7 @@ Hard Break",
559588
"content": [
560589
{
561590
"styles": {
591+
"backgroundColor": "transparent",
562592
"textColor": "rgb(0, 0, 0)",
563593
},
564594
"text": "Cell 5",
@@ -578,6 +608,7 @@ Hard Break",
578608
"content": [
579609
{
580610
"styles": {
611+
"backgroundColor": "transparent",
581612
"textColor": "rgb(0, 0, 0)",
582613
},
583614
"text": "Cell 6",
@@ -601,6 +632,7 @@ Hard Break",
601632
"content": [
602633
{
603634
"styles": {
635+
"backgroundColor": "transparent",
604636
"textColor": "rgb(0, 0, 0)",
605637
},
606638
"text": "Cell 7",
@@ -620,6 +652,7 @@ Hard Break",
620652
"content": [
621653
{
622654
"styles": {
655+
"backgroundColor": "transparent",
623656
"textColor": "rgb(0, 0, 0)",
624657
},
625658
"text": "Cell 8",
@@ -639,6 +672,7 @@ Hard Break",
639672
"content": [
640673
{
641674
"styles": {
675+
"backgroundColor": "transparent",
642676
"textColor": "rgb(0, 0, 0)",
643677
},
644678
"text": "Cell 9",
@@ -670,6 +704,7 @@ Hard Break",
670704
"content": [
671705
{
672706
"styles": {
707+
"backgroundColor": "transparent",
673708
"textColor": "rgb(0, 0, 0)",
674709
},
675710
"text": "Paragraph",

0 commit comments

Comments
 (0)