Пример #1
0
    def test_compressed_js(self):
        """
        Verify the behavior of compressed_css, with the pipeline
        both enabled and disabled.
        """
        # Verify that a single JS file is rendered with the pipeline enabled
        with self.settings(PIPELINE_ENABLED=True):
            js_include = compressed_js('base_application')
            self.assertIn(u'lms-base-application.js', js_include)

        # Verify that multiple JS files are rendered with the pipeline disabled
        with self.settings(PIPELINE_ENABLED=False):
            js_include = compressed_js('base_application')
            self.assertIn(u'/static/js/src/logger.js', js_include)
Пример #2
0
    def test_compressed_js(self):
        """
        Verify the behavior of compressed_css, with the pipeline
        both enabled and disabled.
        """
        # Verify that a single JS file is rendered with the pipeline enabled
        with self.settings(PIPELINE_ENABLED=True):
            js_include = compressed_js('base_application')
            self.assertIn(u'lms-base-application.js', js_include)

        # Verify that multiple JS files are rendered with the pipeline disabled
        with self.settings(PIPELINE_ENABLED=False):
            js_include = compressed_js('base_application')
            self.assertIn(u'/static/js/src/logger.js', js_include)
Пример #3
0
    def test_compressed_js(self, mock_staticfiles_lookup, mock_staticfiles_exists):
        """
        Verify the behavior of compressed_css, with the pipeline
        both enabled and disabled.
        """
        pipeline = settings.PIPELINE.copy()
        # Verify that a single JS file is rendered with the pipeline enabled
        pipeline['PIPELINE_ENABLED'] = True
        with self.settings(PIPELINE=pipeline):
            js_include = compressed_js('base_application')
            self.assertIn(u'lms-base-application.js', js_include)

        # Verify that multiple JS files are rendered with the pipeline disabled
        pipeline['PIPELINE_ENABLED'] = False
        with self.settings(PIPELINE=pipeline):
            js_include = compressed_js('base_application')
            self.assertIn(u'/static/js/src/logger.js', js_include)
Пример #4
0
def render_js(context,group):
    __M_caller = context.caller_stack._push_frame()
    try:
        settings = context.get('settings', UNDEFINED)
        __M_writer = context.writer()
        __M_writer(u'\n')
        if settings.PIPELINE_ENABLED:
            __M_writer(u'    ')
            __M_writer(filters.decode.utf8(compressed_js(group) ))
            __M_writer(u'\n')
        else:
            for filename in settings.PIPELINE_JS[group]['source_filenames']:
                __M_writer(u'      <script type="text/javascript" src="')
                __M_writer(filters.html_escape(filters.decode.utf8(staticfiles_storage.url(filename.replace('.coffee', '.js')))))
                __M_writer(u'"></script>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()
def render_js(context,group):
    __M_caller = context.caller_stack._push_frame()
    try:
        settings = context.get('settings', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 22
        __M_writer(u'\n')
        # SOURCE LINE 23
        if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
            # SOURCE LINE 24
            __M_writer(u'    ')
            __M_writer(filters.decode.utf8(compressed_js(group)))
            __M_writer(u'\n')
            # SOURCE LINE 25
        else:
            # SOURCE LINE 26
            for filename in settings.PIPELINE_JS[group]['source_filenames']:
                # SOURCE LINE 27
                __M_writer(u'      <script type="text/javascript" src="')
                __M_writer(filters.decode.utf8(staticfiles_storage.url(filename.replace('.coffee', '.js'))))
                __M_writer(u'"></script>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()