Skip to content

Commit

Permalink
Add test cases for single quoted tag values
Browse files Browse the repository at this point in the history
Neither double quotes nor single quotes should not be escaped when
they are used inside of a tag. That is, the following should all
result in the same HTML:

* [tag=value param=value]
* [tag='value' param='value']
* [tag="value" param="value"]
  • Loading branch information
hemberger committed Jan 19, 2022
1 parent b0ed47d commit 69585c1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/ConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ public function provideSpecialCharacterTests() {
'html' => "This <woo!> &\"yeah!\" 'sizzle'",
'escape_content' => false,
]],
[[
'descr' => "Single quotes in tags are NOT considered special characters.",
'bbcode' => "[wiki='foo' title='bar']",
'html' => "<a href=\"/?page=foo\" class=\"bbcode_wiki\">bar</a>",
]],
[[
'descr' => "Double quotes in tags are NOT considered special characters.",
'bbcode' => "[wiki=\"foo\" title=\"bar\"]",
'html' => "<a href=\"/?page=foo\" class=\"bbcode_wiki\">bar</a>",
]],
[[
'descr' => ":-) produces a smiley <img> element.",
'bbcode' => "This is a test of the emergency broadcasting system :-)",
Expand Down Expand Up @@ -384,10 +394,15 @@ public function provideInlineConversionTests() {
'html' => "This is a test of the <span style=\"font-family:'Times New Roman'\">emergency broadcasting system</span>.",
]],
[[
'descr' => "[font=\"Courier New\"] gets correctly converted (quoted default value).",
'descr' => "[font=\"Courier New\"] gets correctly converted (double quoted default value).",
'bbcode' => "This is a test of the [font=\"Courier New\"]emergency broadcasting system[/font].",
'html' => "This is a test of the <span style=\"font-family:'Courier New'\">emergency broadcasting system</span>.",
]],
[[
'descr' => "[font='Courier New'] gets correctly converted (single quoted default value).",
'bbcode' => "This is a test of the [font='Courier New']emergency broadcasting system[/font].",
'html' => "This is a test of the <span style=\"font-family:'Courier New'\">emergency broadcasting system</span>.",
]],
[[
'descr' => "[font=\"Courier New\" blarg size=1] gets converted (floating parameter ignored).",
'bbcode' => "This is a test of the [font=\"Courier New\" blarg size=1]emergency broadcasting system[/font].",
Expand Down

0 comments on commit 69585c1

Please sign in to comment.