|
27 | 27 | InputInteractiveElement, |
28 | 28 | InteractiveElement, |
29 | 29 | PlainTextObject, |
| 30 | + RichTextBlock, |
30 | 31 | ) |
31 | 32 | from slack_sdk.models.blocks.basic_components import SlackFile |
32 | 33 | from slack_sdk.models.blocks.block_elements import ( |
|
37 | 38 | WorkflowButtonElement, |
38 | 39 | RichTextInputElement, |
39 | 40 | FileInputElement, |
| 41 | + RichTextSectionElement, |
| 42 | + RichTextElementParts, |
40 | 43 | ) |
41 | 44 | from . import STRING_3001_CHARS, STRING_301_CHARS |
42 | 45 |
|
@@ -1069,6 +1072,43 @@ def test_document(self): |
1069 | 1072 | } |
1070 | 1073 | self.assertDictEqual(input, RichTextInputElement(**input).to_dict()) |
1071 | 1074 |
|
| 1075 | + def test_issue_1571(self): |
| 1076 | + self.assertDictEqual( |
| 1077 | + RichTextInputElement( |
| 1078 | + action_id="contents", |
| 1079 | + initial_value=RichTextBlock( |
| 1080 | + elements=[ |
| 1081 | + RichTextSectionElement( |
| 1082 | + elements=[ |
| 1083 | + RichTextElementParts.Text(text="Hey, "), |
| 1084 | + RichTextElementParts.Text(text="this", style={"italic": True}), |
| 1085 | + RichTextElementParts.Text(text="is what you should be looking at. "), |
| 1086 | + RichTextElementParts.Text(text="Please", style={"bold": True}), |
| 1087 | + ] |
| 1088 | + ) |
| 1089 | + ], |
| 1090 | + ), |
| 1091 | + ).to_dict(), |
| 1092 | + { |
| 1093 | + "action_id": "contents", |
| 1094 | + "initial_value": { |
| 1095 | + "elements": [ |
| 1096 | + { |
| 1097 | + "elements": [ |
| 1098 | + {"text": "Hey, ", "type": "text"}, |
| 1099 | + {"style": {"italic": True}, "text": "this", "type": "text"}, |
| 1100 | + {"text": "is what you should be looking at. ", "type": "text"}, |
| 1101 | + {"style": {"bold": True}, "text": "Please", "type": "text"}, |
| 1102 | + ], |
| 1103 | + "type": "rich_text_section", |
| 1104 | + } |
| 1105 | + ], |
| 1106 | + "type": "rich_text", |
| 1107 | + }, |
| 1108 | + "type": "rich_text_input", |
| 1109 | + }, |
| 1110 | + ) |
| 1111 | + |
1072 | 1112 |
|
1073 | 1113 | class PlainTextInputElementTests(unittest.TestCase): |
1074 | 1114 | def test_document_1(self): |
|
0 commit comments