tests: Add unit tests for preservation of quotes in CSS styles
These tests will ensure that issues #21 and #56 do not return.
This commit is contained in:
parent
7739f058c3
commit
908fe9df34
2 changed files with 16 additions and 0 deletions
11
testscour.py
11
testscour.py
|
|
@ -1818,6 +1818,17 @@ class HandleQuotesInAttributes(unittest.TestCase):
|
|||
'Failed on attribute value with the same number of double quotes as single quotes')
|
||||
|
||||
|
||||
class PreserveQuotesInStyles(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
with open('unittests/quotes-in-styles.svg', "rb") as f:
|
||||
output = scourString(f.read())
|
||||
self.assertTrue('use[id="t"]' in output,
|
||||
'Failed to preserve quote characters in a style element')
|
||||
self.assertTrue("'Times New Roman'" in output,
|
||||
'Failed to preserve quote characters in a style attribute')
|
||||
|
||||
|
||||
class DoNotStripCommentsOutsideOfRoot(unittest.TestCase):
|
||||
|
||||
def runTest(self):
|
||||
|
|
|
|||
5
unittests/quotes-in-styles.svg
Normal file
5
unittests/quotes-in-styles.svg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<style>use[id="t"] {font-size: small}</style>
|
||||
<text id="t" style="font-family:'Times New Roman'"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 188 B |
Loading…
Add table
Add a link
Reference in a new issue