Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
ffd8d9f9
Commit
ffd8d9f9
authored
Feb 14, 2014
by
Philipp Wollermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test compressed_js for correct whitespace, async and defer. Add myself to AUTHORS.
parent
c83365d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
2 deletions
+64
-2
AUTHORS
+1
-0
tests/settings.py
+37
-0
tests/tests/test_template.py
+26
-2
No files found.
AUTHORS
View file @
ffd8d9f9
...
...
@@ -51,6 +51,7 @@ or just made Pipeline more awesome.
* Miroslav Shubernetskiy <miroslav@miki725.com>
* Patrick Altman <paltman@gmail.com>
* Peter Baumgartner <pete@lincolnloop.com>
* Philipp Wollermann <philipp.wollermann@gmail.com>
* Pierre Drescher <pierre.drescher@gmail.com>
* Rajiv Bose <nerd.bose@gmail.com>
* Rami Chowdhury <rami.chowdhury@gmail.com>
...
...
tests/settings.py
View file @
ffd8d9f9
...
...
@@ -65,5 +65,42 @@ PIPELINE_JS = {
'pipeline/templates/**/*.jst'
),
'output_filename'
:
'scripts.js'
},
'scripts_async'
:
{
'source_filenames'
:
(
'pipeline/js/first.js'
,
'pipeline/js/second.js'
,
'pipeline/js/application.js'
,
'pipeline/templates/**/*.jst'
),
'output_filename'
:
'scripts_async.js'
,
'extra_context'
:
{
'async'
:
True
,
}
},
'scripts_defer'
:
{
'source_filenames'
:
(
'pipeline/js/first.js'
,
'pipeline/js/second.js'
,
'pipeline/js/application.js'
,
'pipeline/templates/**/*.jst'
),
'output_filename'
:
'scripts_defer.js'
,
'extra_context'
:
{
'defer'
:
True
,
}
},
'scripts_async_defer'
:
{
'source_filenames'
:
(
'pipeline/js/first.js'
,
'pipeline/js/second.js'
,
'pipeline/js/application.js'
,
'pipeline/templates/**/*.jst'
),
'output_filename'
:
'scripts_async_defer.js'
,
'extra_context'
:
{
'async'
:
True
,
'defer'
:
True
,
}
}
}
tests/tests/test_template.py
View file @
ffd8d9f9
...
...
@@ -35,7 +35,19 @@ class JinjaTest(TestCase):
def
test_package_js
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts"
%
}"""
)
self
.
assertEqual
(
u'<script type="text/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
template
.
render
())
self
.
assertEqual
(
u'<script type="text/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
template
.
render
())
def
test_package_js_async
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts_async"
%
}"""
)
self
.
assertEqual
(
u'<script async type="text/javascript" src="/static/scripts_async.js" charset="utf-8"></script>'
,
template
.
render
())
def
test_package_js_defer
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts_defer"
%
}"""
)
self
.
assertEqual
(
u'<script defer type="text/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>'
,
template
.
render
())
def
test_package_js_async_defer
(
self
):
template
=
self
.
env
.
from_string
(
u"""{
%
compressed_js "scripts_async_defer"
%
}"""
)
self
.
assertEqual
(
u'<script async defer type="text/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>'
,
template
.
render
())
class
DjangoTest
(
TestCase
):
...
...
@@ -52,4 +64,16 @@ class DjangoTest(TestCase):
def
test_compressed_js
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts"
%
}"""
)
self
.
assertEqual
(
u'<script type="text/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
rendered
)
self
.
assertEqual
(
u'<script type="text/javascript" src="/static/scripts.js" charset="utf-8"></script>'
,
rendered
)
def
test_compressed_js_async
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts_async"
%
}"""
)
self
.
assertEqual
(
u'<script async type="text/javascript" src="/static/scripts_async.js" charset="utf-8"></script>'
,
rendered
)
def
test_compressed_js_defer
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts_defer"
%
}"""
)
self
.
assertEqual
(
u'<script defer type="text/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>'
,
rendered
)
def
test_compressed_js_async_defer
(
self
):
rendered
=
self
.
render_template
(
u"""{
%
load compressed
%
}{
%
compressed_js "scripts_async_defer"
%
}"""
)
self
.
assertEqual
(
u'<script async defer type="text/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>'
,
rendered
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment