mirror of
https://github.com/django/django.git
synced 2025-10-27 10:16:27 +00:00
Improved on r17454 to ensure that collapse.js only gets minified when DEBUG is False.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17455 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a90aad3511
commit
0f6cf4aba1
6 changed files with 57 additions and 63 deletions
|
|
@ -573,6 +573,7 @@ class AdminViewBasicTest(TestCase):
|
|||
except SuspiciousOperation:
|
||||
self.fail("Filters should be allowed if they are defined on a ForeignKey pointing to this model")
|
||||
|
||||
|
||||
class AdminJavaScriptTest(AdminViewBasicTest):
|
||||
urls = "regressiontests.admin_views.urls"
|
||||
|
||||
|
|
@ -598,6 +599,40 @@ class AdminJavaScriptTest(AdminViewBasicTest):
|
|||
)
|
||||
|
||||
|
||||
def test_js_minified_only_if_debug_is_false(self):
|
||||
"""
|
||||
Ensure that the minified versions of the JS files are only used when
|
||||
DEBUG is False.
|
||||
Refs #17521.
|
||||
"""
|
||||
with override_settings(DEBUG=False):
|
||||
response = self.client.get(
|
||||
'/test_admin/%s/admin_views/section/add/' % self.urlbit)
|
||||
self.assertNotContains(response, 'jquery.js')
|
||||
self.assertContains(response, 'jquery.min.js')
|
||||
self.assertNotContains(response, 'prepopulate.js')
|
||||
self.assertContains(response, 'prepopulate.min.js')
|
||||
self.assertNotContains(response, 'actions.js')
|
||||
self.assertContains(response, 'actions.min.js')
|
||||
self.assertNotContains(response, 'collapse.js')
|
||||
self.assertContains(response, 'collapse.min.js')
|
||||
self.assertNotContains(response, 'inlines.js')
|
||||
self.assertContains(response, 'inlines.min.js')
|
||||
with override_settings(DEBUG=True):
|
||||
response = self.client.get(
|
||||
'/test_admin/%s/admin_views/section/add/' % self.urlbit)
|
||||
self.assertContains(response, 'jquery.js')
|
||||
self.assertNotContains(response, 'jquery.min.js')
|
||||
self.assertContains(response, 'prepopulate.js')
|
||||
self.assertNotContains(response, 'prepopulate.min.js')
|
||||
self.assertContains(response, 'actions.js')
|
||||
self.assertNotContains(response, 'actions.min.js')
|
||||
self.assertContains(response, 'collapse.js')
|
||||
self.assertNotContains(response, 'collapse.min.js')
|
||||
self.assertContains(response, 'inlines.js')
|
||||
self.assertNotContains(response, 'inlines.min.js')
|
||||
|
||||
|
||||
class SaveAsTests(TestCase):
|
||||
urls = "regressiontests.admin_views.urls"
|
||||
fixtures = ['admin-views-users.xml','admin-views-person.xml']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue