mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 16:57:16 +08:00
FIX: proper details / summary excerpt (#30229)
It doesn't make much sense to have the content of a `<details>` in an excerpt so I replaced them with "▶ summary" instead. That way, they can't be (ab)used in user cards for example. Reference - https://meta.discourse.org/t/335094
This commit is contained in:
@ -923,16 +923,10 @@ RSpec.describe PrettyText do
|
||||
).to eq("")
|
||||
end
|
||||
|
||||
it "should keep details if too long" do
|
||||
it "replaces details / summary with the summary" do
|
||||
expect(
|
||||
PrettyText.excerpt("<details><summary>expand</summary><p>hello</p></details>", 6),
|
||||
).to match_html "<details class='disabled'><summary>expand</summary></details>"
|
||||
end
|
||||
|
||||
it "doesn't disable details if short enough" do
|
||||
expect(
|
||||
PrettyText.excerpt("<details><summary>expand</summary><p>hello</p></details>", 60),
|
||||
).to match_html "<details><summary>expand</summary>hello</details>"
|
||||
).to match_html "▶ expand"
|
||||
end
|
||||
|
||||
it "should remove meta information" do
|
||||
|
Reference in New Issue
Block a user