Skip to content

Commit

Permalink
Merge pull request #109 from jimmyruann/master
Browse files Browse the repository at this point in the history
Fix RichText type issue with views
  • Loading branch information
imryche authored Feb 12, 2024
2 parents 1371b6a + 72ab51a commit 54fbefa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion blockkit/surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Header,
ImageBlock,
Input,
RichText,
Section,
)
from blockkit.components import Component
Expand All @@ -17,7 +18,7 @@

__all__ = ["Home", "Message", "Modal", "WorkflowStep"]

Block = Union[Actions, Context, Divider, Header, ImageBlock, Input, Section]
Block = Union[Actions, Context, Divider, Header, ImageBlock, Input, RichText, Section]


class View(Component):
Expand Down
20 changes: 16 additions & 4 deletions tests/test_surfaces.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from blockkit.blocks import Input, Section
from blockkit.blocks import Input, RichText, RichTextSection, Section
from blockkit.elements import Button, PlainTextInput
from blockkit.objects import MarkdownText, PlainText
from blockkit.objects import MarkdownText, PlainText, Text
from blockkit.surfaces import Home, Message, Modal, WorkflowStep
from pydantic import ValidationError

Expand Down Expand Up @@ -199,7 +199,10 @@ def test_builds_message():
Section(
text=MarkdownText(text="*markdown* text"),
accessory=Button(text=PlainText(text="button"), action_id="action_id"),
)
),
RichText(
elements=[RichTextSection(elements=[Text(text="test_rich_text")])]
),
],
).build() == {
"text": "message text",
Expand All @@ -212,7 +215,16 @@ def test_builds_message():
"text": {"type": "plain_text", "text": "button"},
"action_id": "action_id",
},
}
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [{"type": "text", "text": "test_rich_text"}],
}
],
},
],
}

Expand Down

0 comments on commit 54fbefa

Please sign in to comment.