mirror of
https://github.com/django/django.git
synced 2024-12-29 12:36:08 +00:00
845817b039
Thanks Aymeric Augustin and Florian Apolloner for work on the patch.
22 lines
833 B
Python
22 lines
833 B
Python
from __future__ import unicode_literals
|
|
|
|
from django.template.loader import render_to_string
|
|
from django.test import SimpleTestCase
|
|
|
|
|
|
class TestTemplates(SimpleTestCase):
|
|
def test_javascript_escaping(self):
|
|
context = {
|
|
'inline_admin_formset': {
|
|
'formset': {'prefix': 'my-prefix'},
|
|
'opts': {'verbose_name': 'verbose name\\'},
|
|
},
|
|
}
|
|
output = render_to_string('admin/edit_inline/stacked.html', context)
|
|
self.assertIn('prefix: "my\\u002Dprefix",', output)
|
|
self.assertIn('addText: "Add another Verbose name\\u005C"', output)
|
|
|
|
output = render_to_string('admin/edit_inline/tabular.html', context)
|
|
self.assertIn('prefix: "my\\u002Dprefix",', output)
|
|
self.assertIn('addText: "Add another Verbose name\\u005C"', output)
|