diff --git a/compressor/tests/test_offline.py b/compressor/tests/test_offline.py index b172a87..5efe802 100644 --- a/compressor/tests/test_offline.py +++ b/compressor/tests/test_offline.py @@ -323,12 +323,23 @@ class OfflineCompressTestCaseWithContext(OfflineTestCaseMixin, TestCase): } +class OfflineCompressTestCaseWithContextSuper(OfflineTestCaseMixin, TestCase): + templates_dir = 'test_with_context_super' + expected_hash = 'b1d0a333a4ef' + additional_test_settings = { + 'COMPRESS_OFFLINE_CONTEXT': { + 'content': 'OK!', + } + } + # Block.super not supported for Jinja2 yet. + engines = ('django',) + + class OfflineCompressTestCaseWithContextList(OfflineTestCaseMixin, TestCase): templates_dir = 'test_with_context' expected_hash = ['f8bcaea049b3', 'db12749b1e80', 'e9f4a0054a06'] additional_test_settings = { - 'COMPRESS_OFFLINE_CONTEXT': [{ - 'content': 'OK %d!' % i} for i in range(1, 4)] + 'COMPRESS_OFFLINE_CONTEXT': list(offline_context_generator()) } def _prepare_contexts(self, engine): @@ -339,6 +350,17 @@ class OfflineCompressTestCaseWithContextList(OfflineTestCaseMixin, TestCase): return None +class OfflineCompressTestCaseWithContextListSuper( + OfflineCompressTestCaseWithContextList): + templates_dir = 'test_with_context_super' + expected_hash = ['b11543f1e174', 'aedf6d2a7ec7', '0dbb8c29f23a'] + additional_test_settings = { + 'COMPRESS_OFFLINE_CONTEXT': list(offline_context_generator()) + } + # Block.super not supported for Jinja2 yet. + engines = ('django',) + + class OfflineCompressTestCaseWithContextGenerator( OfflineTestCaseMixin, TestCase): templates_dir = 'test_with_context' @@ -358,6 +380,18 @@ class OfflineCompressTestCaseWithContextGenerator( return None +class OfflineCompressTestCaseWithContextGeneratorSuper( + OfflineCompressTestCaseWithContextGenerator): + templates_dir = 'test_with_context_super' + expected_hash = ['b11543f1e174', 'aedf6d2a7ec7', '0dbb8c29f23a'] + additional_test_settings = { + 'COMPRESS_OFFLINE_CONTEXT': 'compressor.tests.test_offline.' + 'offline_context_generator' + } + # Block.super not supported for Jinja2 yet. + engines = ('django',) + + class OfflineCompressTestCaseWithContextGeneratorImportError( OfflineTestCaseMixin, TestCase): templates_dir = 'test_with_context' diff --git a/compressor/tests/test_templates/test_with_context_super/base.html b/compressor/tests/test_templates/test_with_context_super/base.html new file mode 100644 index 0000000..4de1806 --- /dev/null +++ b/compressor/tests/test_templates/test_with_context_super/base.html @@ -0,0 +1,7 @@ +{% spaceless %} +{% block js %} + +{% endblock %} +{% endspaceless %} diff --git a/compressor/tests/test_templates/test_with_context_super/test_compressor_offline.html b/compressor/tests/test_templates/test_with_context_super/test_compressor_offline.html new file mode 100644 index 0000000..9a144e7 --- /dev/null +++ b/compressor/tests/test_templates/test_with_context_super/test_compressor_offline.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} +{% load compress %} + +{% block js %}{% spaceless %} + {% compress js %} + {{ block.super }} + + {% endcompress %} +{% endspaceless %}{% endblock %} + +{% block css %}{% endblock %}