Skip to content

Commit 57cfd50

Browse files
committed
Fix zostera#255 CSS link tag, plus tests
1 parent cf822b9 commit 57cfd50

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ History
44
-------
55

66

7+
6.0.0 (2015-04-21)
8+
++++++++++++++++++
9+
10+
* No more media="screen" in CSS tags, complying to Bootstraps examples
11+
12+
713
5.4.0 (2015-04-21)
814
++++++++++++++++++
915

bootstrap3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = '5.4.0'
3+
__version__ = '6.0.0'

bootstrap3/tests.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,18 @@ def test_settings(self):
141141
from .bootstrap import BOOTSTRAP3
142142
self.assertTrue(BOOTSTRAP3)
143143

144+
def test_bootstrap_javascript_tag(self):
145+
res = render_template('{% bootstrap_javascript %}')
146+
self.assertEqual(res.strip(), '<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>')
147+
148+
def test_bootstrap_css_tag(self):
149+
res = render_template('{% bootstrap_css %}')
150+
self.assertEqual(res.strip(), '<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">')
151+
144152
def test_settings_filter(self):
145-
res = render_template(
146-
'{% load bootstrap3 %}' +
147-
'{{ "required_css_class"|bootstrap_setting }}')
153+
res = render_template('{{ "required_css_class"|bootstrap_setting }}')
148154
self.assertEqual(res.strip(), 'bootstrap3-req')
149-
res = render_template(
150-
'{% load bootstrap3 %}' +
151-
'{% if "javascript_in_head"|bootstrap_setting %}' +
152-
'head{% else %}body{% endif %}'
153-
)
155+
res = render_template('{% if "javascript_in_head"|bootstrap_setting %}head{% else %}body{% endif %}')
154156
self.assertEqual(res.strip(), 'head')
155157

156158
def test_required_class(self):

bootstrap3/utils.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from django.template import Variable, VariableDoesNotExist
88
from django.template.base import FilterExpression, kwarg_re, TemplateSyntaxError
99

10-
1110
from .text import text_value
1211

1312

@@ -97,14 +96,17 @@ def remove_css_class(css_classes, css_class):
9796
return ' '.join(classes_list)
9897

9998

100-
def render_link_tag(url, rel='stylesheet', media='all'):
99+
def render_link_tag(url, rel='stylesheet', media=None):
101100
"""
102101
Build a link tag
103102
"""
104-
return render_tag(
105-
'link',
106-
attrs={'href': url, 'rel': rel, 'media': media},
107-
close=False)
103+
attrs = {
104+
'href': url,
105+
'rel': rel,
106+
}
107+
if media:
108+
attrs['media'] = media
109+
return render_tag('link', attrs=attrs, close=False)
108110

109111

110112
def render_tag(tag, attrs=None, content=None, close=True):

0 commit comments

Comments
 (0)