aboutsummaryrefslogtreecommitdiffstats
path: root/_pytest/test_render_blocks.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-23 00:04:45 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2023-08-23 00:12:24 +0200
commit2d55e8e4d252f21026431e05f234f10fd14091ec (patch)
tree244e4b6906dd2577afb8928d58cf2a0754a0017c /_pytest/test_render_blocks.py
parentdd354a6f06cfbd0ff1b099630e1fe61628684158 (diff)
downloadwee-slack-2d55e8e4d252f21026431e05f234f10fd14091ec.tar.gz
Render adjacent text styles correctly
Fixes #550 properly.
Diffstat (limited to '_pytest/test_render_blocks.py')
-rw-r--r--_pytest/test_render_blocks.py111
1 files changed, 110 insertions, 1 deletions
diff --git a/_pytest/test_render_blocks.py b/_pytest/test_render_blocks.py
index 28f6bfe..d852fb3 100644
--- a/_pytest/test_render_blocks.py
+++ b/_pytest/test_render_blocks.py
@@ -112,7 +112,7 @@ import wee_slack
"rendered": [
"normal <[color bold]>*bold*<[color -bold]> <[color italic]>_italic_"
"<[color -italic]> ~strikethrough~ <[color bold]><[color italic]>"
- "*_~bold-italic-strikethrough~_*<[color -bold]><[color -italic]> "
+ "*_~bold-italic-strikethrough~_*<[color -italic]><[color -bold]> "
"https://vg.no (link)",
"1. number",
"2. list",
@@ -244,6 +244,115 @@ import wee_slack
"• end bullet list",
],
},
+ {
+ "blocks": [
+ {
+ "type": "rich_text",
+ "block_id": "usQpu",
+ "elements": [
+ {
+ "type": "rich_text_section",
+ "elements": [
+ {
+ "type": "text",
+ "text": "test ",
+ "style": {"code": True},
+ },
+ {
+ "type": "link",
+ "url": "http://asdf.de",
+ "text": "asdf.de",
+ "style": {"code": True},
+ },
+ {
+ "type": "text",
+ "text": " asdf.de:443",
+ "style": {"code": True},
+ },
+ {"type": "text", "text": "\n"},
+ ],
+ },
+ {
+ "type": "rich_text_preformatted",
+ "elements": [
+ {"type": "text", "text": "asdf.de\nasdf.de:443"}
+ ],
+ "border": 0,
+ },
+ ],
+ }
+ ],
+ "rendered": [
+ "`test asdf.de asdf.de:443`",
+ "```\nasdf.de\nasdf.de:443\n```",
+ ],
+ },
+ {
+ "blocks": [
+ {
+ "type": "rich_text",
+ "block_id": "vLtn",
+ "elements": [
+ {
+ "type": "rich_text_section",
+ "elements": [
+ {
+ "type": "text",
+ "text": "bold ",
+ "style": {"bold": True},
+ },
+ {
+ "type": "text",
+ "text": "code ",
+ "style": {"bold": True, "code": True},
+ },
+ {
+ "type": "text",
+ "text": "not bold ",
+ "style": {"code": True},
+ },
+ {
+ "type": "text",
+ "text": "italic",
+ "style": {"italic": True, "code": True},
+ },
+ {
+ "type": "text",
+ "text": " text",
+ "style": {"italic": True},
+ },
+ ],
+ }
+ ],
+ }
+ ],
+ "rendered": [
+ "<[color bold]>*bold `code *<[color -bold]>not bold <[color italic]>_italic` text_<[color -italic]>",
+ ],
+ },
+ {
+ "blocks": [
+ {
+ "type": "rich_text",
+ "block_id": "28L",
+ "elements": [
+ {
+ "type": "rich_text_section",
+ "elements": [
+ {
+ "type": "text",
+ "text": "bold and italic combined",
+ "style": {"bold": True, "italic": True},
+ }
+ ],
+ }
+ ],
+ }
+ ],
+ "rendered": [
+ "<[color bold]><[color italic]>*_bold and italic combined_*<[color -italic]><[color -bold]>"
+ ],
+ },
],
)
def test_render_blocks(case):