Update codepen tag to accept links with trailing /'s (#886)
This commit is contained in:
parent
85a7c97b9b
commit
c3c420defd
2 changed files with 8 additions and 1 deletions
|
|
@ -29,7 +29,7 @@ class CodepenTag < LiquidTagBase
|
|||
def valid_link?(link)
|
||||
link_no_space = link.delete(" ")
|
||||
(link_no_space =~
|
||||
/^(http|https):\/\/(codepen\.io)\/[a-zA-Z0-9\-]{1,20}\/pen\/([a-zA-Z]{5,7})\z/)&.zero?
|
||||
/^(http|https):\/\/(codepen\.io)\/[a-zA-Z0-9\-]{1,20}\/pen\/([a-zA-Z]{5,7})\/{0,1}\z/)&.zero?
|
||||
end
|
||||
|
||||
def raise_error
|
||||
|
|
|
|||
|
|
@ -21,6 +21,13 @@ RSpec.describe CodepenTag, type: :liquid_template do
|
|||
Approvals.verify(rendered_codepen_iframe, name: "codepen_liquid_tag", format: :html)
|
||||
end
|
||||
|
||||
it "accepts codepen link with a / at the end" do
|
||||
codepen_link = "https://codepen.io/twhite96/pen/XKqrJX/"
|
||||
expect do
|
||||
generate_new_liquid(codepen_link)
|
||||
end.not_to raise_error
|
||||
end
|
||||
|
||||
it "rejects invalid codepen link" do
|
||||
expect do
|
||||
generate_new_liquid("invalid_codepen_link")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue