1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #30468 -- Fixed assertHTMLEqual() to handle all ASCII whitespace in a class attribute.

This commit is contained in:
Jon Dufresne
2019-05-09 08:18:18 -07:00
committed by Carlton Gibson
parent de6d3afb97
commit b7a33ee4f0
2 changed files with 15 additions and 1 deletions

View File

@@ -613,6 +613,20 @@ class HTMLEqualTests(SimpleTestCase):
'<input type="text" id="id_name" />',
'<input type="password" id="id_name" />')
def test_class_attribute(self):
pairs = [
('<p class="foo bar"></p>', '<p class="bar foo"></p>'),
('<p class=" foo bar "></p>', '<p class="bar foo"></p>'),
('<p class=" foo bar "></p>', '<p class="bar foo"></p>'),
('<p class="foo\tbar"></p>', '<p class="bar foo"></p>'),
('<p class="\tfoo\tbar\t"></p>', '<p class="bar foo"></p>'),
('<p class="\t\t\tfoo\t\t\tbar\t\t\t"></p>', '<p class="bar foo"></p>'),
('<p class="\t \nfoo \t\nbar\n\t "></p>', '<p class="bar foo"></p>'),
]
for html1, html2 in pairs:
with self.subTest(html1):
self.assertHTMLEqual(html1, html2)
def test_normalize_refs(self):
pairs = [
('&#39;', '&#x27;'),