Example #1
0
 def test_string_dependencies(self):
     self.assertListEqual(['echarts', 'echartsgl'],
                          merge_js_dependencies('echartsgl',
                                                self.BASE_CHART))
     self.assertListEqual(['echarts', 'fujian'],
                          merge_js_dependencies('echarts',
                                                ['echarts', 'fujian']))
Example #2
0
 def test_nested_js_dependencies(self):
     self.assertListEqual(['echarts', 'echartsgl', 'fujian'],
                          merge_js_dependencies(
                              merge_js_dependencies(self.BASE_CHART),
                              self.MAP_CHART, self.THREE_D_CHART))
     self.assertListEqual(['echarts', 'echartsgl', 'fujian', 'zhejiang'],
                          merge_js_dependencies(
                              merge_js_dependencies(self.BASE_CHART,
                                                    self.MAP_CHART),
                              self.THREE_D_CHART, 'zhejiang'))
Example #3
0
 def test_one_chart_or_page(self):
     # One chart or one page
     self.assertListEqual(
         ['echarts'],
         merge_js_dependencies(self.BASE_CHART)
     )
     self.assertListEqual(
         ['echarts', 'fujian'],
         merge_js_dependencies(self.MAP_CHART)
     )
Example #4
0
 def test_multiple_charts_and_pages(self):
     # Multiple charts
     self.assertListEqual(['echarts', 'fujian'],
                          merge_js_dependencies(self.BASE_CHART,
                                                self.MAP_CHART))
     self.assertListEqual(['echarts', 'echartsgl'],
                          merge_js_dependencies(self.BASE_CHART,
                                                self.THREE_D_CHART))
     self.assertListEqual(['echarts', 'echartsgl', 'fujian'],
                          merge_js_dependencies(self.MAP_CHART,
                                                self.THREE_D_CHART))
     self.assertListEqual(['echarts', 'echartsgl', 'fujian'],
                          merge_js_dependencies(self.BASE_CHART,
                                                self.MAP_CHART,
                                                self.THREE_D_CHART))
Example #5
0
def echarts_js_dependencies(context, *args):
    dependencies = merge_js_dependencies(*args)
    links = map(DJANGO_ECHARTS_SETTINGS.generate_js_link, dependencies)

    return template.Template('<br/>'.join([
        '<script src="{link}"></script>'.format(link=l) for l in links
    ])).render(context)
Example #6
0
 def js_dependencies(self):
     return merge_js_dependencies(*self)