diff --git a/src/diceutils/renderer/html.py b/src/diceutils/renderer/html.py
index badb46c..0c51543 100644
--- a/src/diceutils/renderer/html.py
+++ b/src/diceutils/renderer/html.py
@@ -45,8 +45,8 @@
/* Position the tooltip text */
position: absolute;
z-index: 1;
- bottom: 125%;
- left: 50%;
+ bottom: calc(100% + 5px);
+ left: calc(50% + 50px);
margin-left: -60px;
/* Fade in tooltip */
diff --git a/tests/test_renderer.py b/tests/test_renderer.py
index 81298d0..4276fd5 100644
--- a/tests/test_renderer.py
+++ b/tests/test_renderer.py
@@ -1,6 +1,8 @@
from diceutils.renderer import Renderer, Messages, Role
from diceutils.renderer.html import HTMLRenderer
+import datetime
+
def test_render():
messages = Messages()
@@ -14,32 +16,14 @@ def test_render():
"text": "男人最终还是跟了上来,只是嘴里连连念叨着:“我是美国公民,我是美国公民……”"
},
},
- {"type": "image", "data": {"url": "http://a.com/2.png"}},
- ]
- msg_content_3 = [
- {
- "type": "text",
- "data": {
- "text": ".rd10*5"
- }
- }
]
+ msg_content_3 = [{"type": "text", "data": {"text": ".rd10*5"}}]
msg_content_4 = [
- {
- "type": "text",
- "data": {
- "text": "[苏向夜]掷骰: 1D10*5={10}*5=50"
- }
- }
+ {"type": "text", "data": {"text": "[苏向夜]掷骰: 1D10*5={10}*5=50"}}
]
msg_content_5 = [
- {
- "type": "text",
- "data": {
- "text": "苏说道:”我们去毁灭人类吧。“Test,“hi"
- }
- }
+ {"type": "text", "data": {"text": "苏说道:”我们去毁灭人类吧。“Test,“hi"}}
]
messages.add_message("230234235", Role.GM, "苏向夜", "date", msg_content_1)
messages.add_message("130324324", Role.PL, "少年狐", "date", msg_content_1)
@@ -51,11 +35,31 @@ def test_render():
"130232542",
Role.OB,
"简律纯",
- "datetime.datetime.now()",
+ str(datetime.datetime.now()),
[
{"type": "text", "data": {"text": "谴责!"}},
+ {
+ "type": "image",
+ "data": {
+ "url": "https://th.bing.com/th/id/OIP.ZTTJgCn_iXE4sM52RK2x7gAAAA?rs=1&pid=ImgDetMain"
+ },
+ },
+ ],
+ )
+ messages.add_message(
+ "130232542",
+ Role.OB,
+ "简律纯",
+ str(datetime.datetime.now()),
+ [
+ {
+ "type": "image",
+ "data": {
+ "url": "https://th.bing.com/th/id/OIP.ZTTJgCn_iXE4sM52RK2x7gAAAA?rs=1&pid=ImgDetMain"
+ },
+ },
],
)
renderer = Renderer.render(messages, HTMLRenderer())
- renderer.export("测试")
\ No newline at end of file
+ renderer.export("测试")