mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 21:21:13 +08:00
DEV: Remove lazy-yt and replace with lazy-videos (#20722)
- Refactors the old plugin to remove jquery usage - Adds support for Vimeo videos (default on) and Tiktok (experimental and default off)
This commit is contained in:
@ -1019,12 +1019,30 @@ RSpec.describe PrettyText do
|
||||
expect(extract_urls(html)).to eq(["https://example.com"])
|
||||
end
|
||||
|
||||
it "should lazyYT videos" do
|
||||
expect(
|
||||
extract_urls(
|
||||
"<div class=\"lazyYT\" data-youtube-id=\"yXEuEUQIP3Q\" data-youtube-title=\"Mister Rogers defending PBS to the US Senate\" data-width=\"480\" data-height=\"270\" data-parameters=\"feature=oembed&wmode=opaque\"></div>",
|
||||
),
|
||||
).to eq(["https://www.youtube.com/watch?v=yXEuEUQIP3Q"])
|
||||
context "when lazy-videos" do
|
||||
it "should extract youtube url" do
|
||||
expect(
|
||||
extract_urls(
|
||||
"<div class=\"lazy-video-container\" data-video-id=\"yXEuEUQIP3Q\" data-video-title=\"Mister Rogers defending PBS to the US Senate\" data-provider-name=\"youtube\"></div>",
|
||||
),
|
||||
).to eq(["https://www.youtube.com/watch?v=yXEuEUQIP3Q"])
|
||||
end
|
||||
|
||||
it "should extract vimeo url" do
|
||||
expect(
|
||||
extract_urls(
|
||||
"<div class=\"lazy-video-container\" data-video-id=\"786646692\" data-video-title=\"Dear Rich\" data-provider-name=\"vimeo\"></div>",
|
||||
),
|
||||
).to eq(["https://vimeo.com/786646692"])
|
||||
end
|
||||
|
||||
it "should extract tiktok url" do
|
||||
expect(
|
||||
extract_urls(
|
||||
"<div class=\"lazy-video-container\" data-video-id=\"6718335390845095173\" data-video-title=\"Scramble up ur name &amp; I’ll try to guess it😍❤️ #foryoupage #petsoftiktok...\" data-provider-name=\"tiktok\"></div>",
|
||||
),
|
||||
).to eq(["https://m.tiktok.com/v/6718335390845095173"])
|
||||
end
|
||||
end
|
||||
|
||||
it "should extract links to posts" do
|
||||
|
Reference in New Issue
Block a user