@@ -44,6 +44,12 @@ def test_simple_and_css_extract(self):
4444 self .assertEqual (main [0 ]['path' ], os .path .join (settings .BASE_DIR , 'assets/bundles/main.js' ))
4545 self .assertEqual (main [1 ]['path' ], os .path .join (settings .BASE_DIR , 'assets/bundles/styles.css' ))
4646
47+ def test_static_url (self ):
48+ self .compile_bundles ('webpack.config.publicPath.js' )
49+ assets = get_assets ()
50+ self .assertEqual (assets ['status' ], 'done' )
51+ self .assertEqual (assets ['publicPath' ], 'http://custom-static-host.com/' )
52+
4753 def test_code_spliting (self ):
4854 self .compile_bundles ('webpack.config.split.js' )
4955 assets = get_assets ()
@@ -60,6 +66,21 @@ def test_code_spliting(self):
6066 vendor = chunks ['vendor' ]
6167 self .assertEqual (vendor [0 ]['path' ], os .path .join (settings .BASE_DIR , 'assets/bundles/vendor.js' ))
6268
69+ def test_templatetags (self ):
70+ self .compile_bundles ('webpack.config.simple.js' )
71+ view = TemplateView .as_view (template_name = 'home.html' )
72+ request = self .factory .get ('/' )
73+ result = view (request )
74+ self .assertIn ('<link type="text/css" href="/static/bundles/styles.css" rel="stylesheet">' , result .rendered_content )
75+ self .assertIn ('<script type="text/javascript" src="/static/bundles/main.js"></script>' , result .rendered_content )
76+
77+
78+ self .compile_bundles ('webpack.config.publicPath.js' )
79+ view = TemplateView .as_view (template_name = 'home.html' )
80+ request = self .factory .get ('/' )
81+ result = view (request )
82+ self .assertIn ('<img src="http://custom-static-host.com/my-image.png"/>' , result .rendered_content )
83+
6384 def test_jinja2 (self ):
6485 self .compile_bundles ('webpack.config.simple.js' )
6586 view = TemplateView .as_view (template_name = 'home.jinja' )
0 commit comments