1
0
mirror of https://github.com/django/django.git synced 2025-10-29 16:46:11 +00:00

[1.8.x] Fixed #24469 -- Refined escaping of Django's form elements in non-Django templates.

Backport of 1f2abf784a from master
This commit is contained in:
Moritz Sichert
2015-03-18 21:42:59 +01:00
committed by Tim Graham
parent 6a2f46f238
commit 44a05a8a91
15 changed files with 197 additions and 21 deletions

View File

@@ -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__())