Added some tests for #21725.

This commit is contained in:
Baptiste Mispelon 2014-02-18 14:46:23 +01:00
parent 578bdb532c
commit cd027aaadf
5 changed files with 37 additions and 0 deletions

View File

View File

@ -0,0 +1,20 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-09-15 19:15+0200\n"
"PO-Revision-Date: 2010-05-12 12:41-0300\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "A nice emoji: 💩"
msgstr "Un beau caractère emoji: 💩"

View File

@ -136,6 +136,17 @@ class JsI18NTests(TestCase):
response = self.client.get('/jsi18n_admin/?language=de') response = self.client.get('/jsi18n_admin/?language=de')
self.assertContains(response, '\\x04') self.assertContains(response, '\\x04')
@modify_settings(INSTALLED_APPS={'append': ['view_tests.app5']})
def test_non_BMP_char(self):
"""
Non-BMP characters should not break the javascript_catalog (#21725).
"""
with self.settings(LANGUAGE_CODE='en-us'), override('fr'):
response = self.client.get('/jsi18n/app5/')
self.assertEqual(response.status_code, 200)
self.assertContains(response, 'emoji')
self.assertContains(response, '\\ud83d\\udca9')
class JsI18NTestsMultiPackage(TestCase): class JsI18NTestsMultiPackage(TestCase):
urls = 'view_tests.urls' urls = 'view_tests.urls'

View File

@ -36,6 +36,11 @@ js_info_dict_admin = {
'packages': ('django.contrib.admin', 'view_tests'), 'packages': ('django.contrib.admin', 'view_tests'),
} }
js_info_dict_app5 = {
'domain': 'djangojs',
'packages': ('view_tests.app5',),
}
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^$', views.index_page), (r'^$', views.index_page),
@ -54,6 +59,7 @@ urlpatterns = patterns('',
# i18n views # i18n views
(r'^i18n/', include('django.conf.urls.i18n')), (r'^i18n/', include('django.conf.urls.i18n')),
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
(r'^jsi18n/app5/$', 'django.views.i18n.javascript_catalog', js_info_dict_app5),
(r'^jsi18n_english_translation/$', 'django.views.i18n.javascript_catalog', js_info_dict_english_translation), (r'^jsi18n_english_translation/$', 'django.views.i18n.javascript_catalog', js_info_dict_english_translation),
(r'^jsi18n_multi_packages1/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages1), (r'^jsi18n_multi_packages1/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages1),
(r'^jsi18n_multi_packages2/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages2), (r'^jsi18n_multi_packages2/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages2),