Add - to support dash character in JSitor liquid tag (#4830) [deploy]
* Add - to support dash character in JSitor liquid tag * Edit spec/liquid_tags/jsitor_tag_spec.rb * Add support for link with hyphen id in jsitor liquid tag
This commit is contained in:
parent
0ef4ce4250
commit
4e4762e3a1
2 changed files with 16 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
class JsitorTag < LiquidTagBase
|
||||
PARTIAL = "liquids/jsitor".freeze
|
||||
URL_REGEXP = /\A(https|http):\/\/jsitor\.com\/embed\/\w+[?a-zA-Z&]*\Z/.freeze
|
||||
ID_REGEXP = /\A[\w&?]+\Z/.freeze
|
||||
URL_REGEXP = /\A(https|http):\/\/jsitor\.com\/embed\/\w+[-?a-zA-Z&]*\Z/.freeze
|
||||
ID_REGEXP = /\A[\w&?-]+\Z/.freeze
|
||||
|
||||
def initialize(tag_name, link, token)
|
||||
super
|
||||
|
|
|
|||
|
|
@ -53,6 +53,20 @@ RSpec.describe JsitorTag, type: :liquid_tag do
|
|||
end.not_to raise_error(StandardError)
|
||||
end
|
||||
|
||||
it "accepts jsitor link with hyphen id" do
|
||||
link = "https://jsitor.com/embed/2o-syYxmi"
|
||||
expect do
|
||||
create_jsitor_liquid_tag(link)
|
||||
end.not_to raise_error(StandardError)
|
||||
end
|
||||
|
||||
it "accepts jsitor id with hyphen" do
|
||||
link = "2o-syYxmi"
|
||||
expect do
|
||||
create_jsitor_liquid_tag(link)
|
||||
end.not_to raise_error(StandardError)
|
||||
end
|
||||
|
||||
it "doesnt accepts jsitor link with a / at the end" do
|
||||
link = "https://jsitor.com/embed/1QgJVmCam/"
|
||||
expect do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue