コード例 #1
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
 def test_bootstrap_js_adds_script_tag_for_multiple_files(self):
     t = template.Template("""
         {% load bootstrap %}
         {% bootstrap_js modal dropdown %}
     """)
     result = t.render(template.Context())
     expected_tags = [get_js_tag("modal"), get_js_tag("dropdown")]
     self.assertEqual("".join(expected_tags), result.strip())
コード例 #2
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
 def test_bootstrap_js_adds_script_tag_for_given_file(self):
     t = template.Template("""
         {% load bootstrap %}
         {% bootstrap_js modal %}
     """)
     result = t.render(template.Context())
     expected_tag = get_js_tag("modal")
     self.assertEqual(expected_tag, result.strip())
コード例 #3
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
    def test_adding_popover_also_adds_twipsy_before_popover_when_twipsy_not_present(self):
        expected_tags = [get_js_tag(f) for f in ["twipsy", "popover"]]

        t = template.Template("""
            {% load bootstrap %}
            {% bootstrap_js popover %}
        """)
        result = t.render(template.Context())
        self.assertEqual("".join(expected_tags), result.strip())
コード例 #4
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
    def test_requesting_all_js_adds_all_files(self):
        expected_tags = [get_js_tag(f) for f in BOOTSTRAP_JS]

        t = template.Template("""
            {% load bootstrap %}
            {% bootstrap_js all %}
        """)
        result = t.render(template.Context())
        self.assertEqual("".join(expected_tags), result.strip())
コード例 #5
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
    def test_only_adds_same_file_once(self):
        expected_tags = [get_js_tag(f) for f in ["modal"]]

        t = template.Template("""
            {% load bootstrap %}
            {% bootstrap_js modal modal %}
        """)
        result = t.render(template.Context())
        self.assertEqual("".join(expected_tags), result.strip())
コード例 #6
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
    def test_fixes_twipsy_order_when_declared_in_wrong_order(self):
        expected_tags = [get_js_tag(f) for f in ["twipsy", "popover"]]

        t = template.Template("""
            {% load bootstrap %}
            {% bootstrap_js popover twipsy %}
        """)
        result = t.render(template.Context())
        self.assertEqual("".join(expected_tags), result.strip())
コード例 #7
0
ファイル: tests.py プロジェクト: madisona/django-bootstrapped
 def test_get_js_tag_returns_minified_js_script_tag_when_not_debug(self):
     settings.TEMPLATE_DEBUG = False
     tag = get_js_tag("modal")
     expected = '<script src="{0}bootstrapped/js/bootstrap-modal.min.js" type="text/javascript"></script>'.format(settings.STATIC_URL)
     self.assertEqual(expected, tag)