mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #24469 -- Refined escaping of Django's form elements in non-Django templates.
This commit is contained in:
parent
dc5b01ad05
commit
1f2abf784a
15 changed files with 198 additions and 21 deletions
|
@ -4,8 +4,10 @@ from __future__ import unicode_literals
|
|||
from unittest import skipUnless
|
||||
|
||||
from django.contrib.gis.geos import HAS_GEOS
|
||||
from django.contrib.gis.maps.google.overlays import GEvent, GOverlayBase
|
||||
from django.test import TestCase
|
||||
from django.test.utils import modify_settings, override_settings
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
GOOGLE_MAPS_API_KEY = 'XXXX'
|
||||
|
||||
|
@ -41,3 +43,14 @@ class GoogleMapsTest(TestCase):
|
|||
title='En français !')
|
||||
google_map = GoogleMap(center=center, zoom=18, markers=[marker])
|
||||
self.assertIn("En français", google_map.scripts)
|
||||
|
||||
def test_gevent_html_safe(self):
|
||||
event = GEvent('click', 'function() {location.href = "http://www.google.com"}')
|
||||
self.assertTrue(hasattr(GEvent, '__html__'))
|
||||
self.assertEqual(force_text(event), event.__html__())
|
||||
|
||||
def test_goverlay_html_safe(self):
|
||||
overlay = GOverlayBase()
|
||||
overlay.js_params = '"foo", "bar"'
|
||||
self.assertTrue(hasattr(GOverlayBase, '__html__'))
|
||||
self.assertEqual(force_text(overlay), overlay.__html__())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue