mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: cook grid bbcode in chat (#29658)
This change will only prevent a cooked message with [grid] to show [grid] instead the content will be wrapped in `div class="d-image-grid"`. This is only enabled on messages made by bot, as regular users could use grid but have no reason to use it ATM. It will also not apply the decoration which shouldn't change the behavior more than just remove grid markup from the message
This commit is contained in:
@@ -99,6 +99,16 @@ describe Chat::Message do
|
||||
<h6><a name="h6-6" class="anchor" href="#h6-6"></a>h6</h6>
|
||||
HTML
|
||||
end
|
||||
|
||||
it "cooks the grid bbcode" do
|
||||
cooked = described_class.cook("[grid]\ntest\n[/grid]", user_id: -1)
|
||||
|
||||
expect(cooked).to match_html <<~HTML
|
||||
<div class="d-image-grid">
|
||||
<p>test</p>
|
||||
</div>
|
||||
HTML
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't support headings" do
|
||||
@@ -109,6 +119,14 @@ describe Chat::Message do
|
||||
HTML
|
||||
end
|
||||
|
||||
it "doesn't support grid" do
|
||||
cooked = described_class.cook("[grid]\ntest\n[/grid]")
|
||||
|
||||
expect(cooked).to match_html <<~HTML
|
||||
<p>[grid]<br>test<br>[/grid]</p>
|
||||
HTML
|
||||
end
|
||||
|
||||
it "supports horizontal replacement" do
|
||||
cooked = described_class.cook("---")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user