mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-06 04:51:37 +00:00
fix: expanded disclosures render their content on Apple platforms (#115863)
* fix(apps): render disclosure body content on Apple platforms * chore(apps): refresh native i18n inventory
This commit is contained in:
committed by
GitHub
parent
a49b553f08
commit
1ab4e08d62
@@ -40227,7 +40227,7 @@
|
||||
},
|
||||
{
|
||||
"kind": "conditional-branch",
|
||||
"line": 735,
|
||||
"line": 737,
|
||||
"path": "apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatMarkdownRenderer.swift",
|
||||
"source": "Image",
|
||||
"surface": "apple",
|
||||
|
||||
@@ -287,10 +287,12 @@ struct ChatMarkdownRenderSnapshot {
|
||||
preparesReveal: false),
|
||||
isExpanded: disclosure.isExpanded,
|
||||
blocks: disclosure.blocks.map {
|
||||
// Reveal locations address only top-level blocks. Disclosure content
|
||||
// uses a nested renderer without reveal state, so render it directly.
|
||||
Self.renderedBlock(
|
||||
$0,
|
||||
isComplete: isComplete,
|
||||
preparesReveal: preparesReveal)
|
||||
preparesReveal: false)
|
||||
}))
|
||||
case .thematicBreak:
|
||||
.thematicBreak
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import Testing
|
||||
@testable import OpenClawChatUI
|
||||
|
||||
struct ChatMarkdownRendererTests {
|
||||
@Test @MainActor func `streaming disclosure body stays directly renderable`() throws {
|
||||
let snapshot = ChatMarkdownRenderSnapshot(
|
||||
text: """
|
||||
<details>
|
||||
<summary>More detail</summary>
|
||||
|
||||
I'm here to help with questions, projects, and practical tasks.
|
||||
|
||||
- Clear answers
|
||||
- Thoughtful assistance
|
||||
|
||||
```bash
|
||||
echo "Hello"
|
||||
```
|
||||
|
||||
</details>
|
||||
""",
|
||||
isComplete: false,
|
||||
preparesReveal: true)
|
||||
guard case let .disclosure(disclosure) = try #require(snapshot.blocks.first) else {
|
||||
Issue.record("expected rendered disclosure")
|
||||
return
|
||||
}
|
||||
|
||||
#expect(String(disclosure.summary.attributed.characters) == "More detail")
|
||||
#expect(disclosure.blocks.count == 2)
|
||||
|
||||
guard case let .prose(prose) = disclosure.blocks[0] else {
|
||||
Issue.record("expected renderable disclosure prose")
|
||||
return
|
||||
}
|
||||
let proseText = String(prose.attributed.characters)
|
||||
#expect(proseText.contains("I'm here to help with questions, projects, and practical tasks."))
|
||||
#expect(proseText.contains("Clear answers"))
|
||||
#expect(proseText.contains("Thoughtful assistance"))
|
||||
#expect(prose.plainText.isEmpty)
|
||||
#expect(prose.prefix.characters.isEmpty)
|
||||
#expect(prose.tail.isEmpty)
|
||||
|
||||
guard case let .code(code) = disclosure.blocks[1] else {
|
||||
Issue.record("expected rendered disclosure code block")
|
||||
return
|
||||
}
|
||||
#expect(code.language == "bash")
|
||||
#expect(code.code == "echo \"Hello\"")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user