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:
Michael Witten 2017-08-27 02:16:31 +00:00 committed by Eduard Braun
parent 0a146b7fef
commit b20a0698cc
2 changed files with 16 additions and 0 deletions

View file

@ -1818,6 +1818,17 @@ class HandleQuotesInAttributes(unittest.TestCase):
'Failed on attribute value with the same number of double quotes as single quotes') '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): class DoNotStripCommentsOutsideOfRoot(unittest.TestCase):
def runTest(self): def runTest(self):

View 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