2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
require 'cgi'
|
|
|
|
|
|
|
|
describe "CGI.unescapeElement when passed String, elements, ..." do
|
|
|
|
it "unescapes only the tags of the passed elements in the passed String" do
|
|
|
|
res = CGI.unescapeElement("<BR><A HREF="url"></A>", "A", "IMG")
|
|
|
|
res.should == '<BR><A HREF="url"></A>'
|
|
|
|
|
|
|
|
res = CGI.unescapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
|
|
|
|
res.should == '<BR><A HREF="url"></A>'
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is case-insensitive" do
|
|
|
|
res = CGI.unescapeElement("<BR><A HREF="url"></A>", "a", "img")
|
|
|
|
res.should == '<BR><A HREF="url"></A>'
|
|
|
|
|
|
|
|
res = CGI.unescapeElement("<br><a href="url"></a>", "A", "IMG")
|
|
|
|
res.should == '<br><a href="url"></a>'
|
|
|
|
end
|
|
|
|
end
|