Ejemplo n.º 1
0
 def test_try_to_render_template_without_the_js_backend(self):
     """
     Raises JsMissingTemplateDirException if the backend is not specified
     """
     context = RequestContext(request=None)
     with self.settings(TEMPLATES=[{"BACKEND": "django.template.backends.django.DjangoTemplates", "DIRS": []}]):
         with self.assertRaises(JsMissingTemplateDirException):
             djangojs.include_js(context, template_name="test-component.js")
Ejemplo n.º 2
0
 def test_try_to_render_template_without_the_js_backend(self):
     """
     Raises JsMissingTemplateDirException if the backend is not specified
     """
     context = RequestContext(request=None)
     with self.settings(TEMPLATES=[{
             'BACKEND': 'django.template.backends.django.DjangoTemplates',
             'DIRS': []
     }]):
         with self.assertRaises(JsMissingTemplateDirException):
             djangojs.include_js(context, template_name='test-component.js')
Ejemplo n.º 3
0
 def test_render_template(self):
     """
     Render a template with the template tag
     """
     context = RequestContext(request=None)
     template = djangojs.include_js(context, template_name="test-component.js")
     self.assertEqual(template, "<span>Test component</span>")
Ejemplo n.º 4
0
 def test_render_template(self):
     """
     Render a template with the template tag
     """
     context = RequestContext(request=None)
     template = djangojs.include_js(context,
                                    template_name='test-component.js')
     self.assertEqual(template, '<span>Test component</span>')