DEV: Add test for poll plugin reduce_excerpt.
This commit is contained in:
parent
2863e7c181
commit
63e3d49508
|
@ -136,4 +136,21 @@ describe PrettyText do
|
||||||
expect(onebox[:preview]).to include("A post with a poll")
|
expect(onebox[:preview]).to include("A post with a poll")
|
||||||
expect(onebox[:preview]).to include("<a href=\"#{post.url}\">poll</a>")
|
expect(onebox[:preview]).to include("<a href=\"#{post.url}\">poll</a>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'can reduce excerpts' do
|
||||||
|
post = Fabricate(:post, raw: <<~EOF)
|
||||||
|
A post with a poll
|
||||||
|
|
||||||
|
[poll type=regular]
|
||||||
|
* Hello
|
||||||
|
* World
|
||||||
|
[/poll]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
excerpt = PrettyText.excerpt(post.cooked, SiteSetting.post_onebox_maxlength, post: post)
|
||||||
|
expect(excerpt).to eq("A post with a poll \n<a href=\"#{post.url}\">poll</a>")
|
||||||
|
|
||||||
|
excerpt = PrettyText.excerpt(post.cooked, SiteSetting.post_onebox_maxlength)
|
||||||
|
expect(excerpt).to eq("A post with a poll \npoll")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue